This is the full language reference for Thorn 0.3. It covers all syntax, built-in types, control flow, and the standard library. This is a draft document accompanying the 0.3 specification.
No declaration keyword. Assign a value and Thorn infers the type.
x = 5 name = "Thorn" active = on nothing = void
Built-in types: number, text, on/off, void, list, map.
task add(x, y) {
send x + y
}
result = add(3, 4)
if (x > 5) {
write("big")
} elif (x == 3) {
write("three")
} else {
write("small")
}
loop(on) { } # forever
loop(15) { } # 15 times
loop(i = 15) { } # with counter
loop(x < 100) { } # condition
loop(item = myList) { } # over list
err = risk {
res = reach(url)
send res.json
}
if (err != void) {
write(v"failed: {err}")
}
try {
# risky code
} catch(e) {
write(e)
}
spawn(fetchData(url))
out = spawn(fetchData(url))
write(v"got: {out}") # waits here
section.global networking {
task connect(url) { }
}
networking.connect("pawnet://ABC12")
need "myfile" need "myfile" as m need myTask from "myfile" need time need math need random
dcmnt = read("path/to/file")
dcmnt = file("path/to/file")
dcmnt.line(14)
dcmnt.write("content")
dcmnt.append("new line")
dcmnt.delete
f = folder("path/to/dir")
f = folder.create("path/to/dir")
f.files / f.folders
res = reach("https://example.com")
res = reach.post(url, data)
res.body / res.status / res.json
task — define a functionsend — return a valueloop() — all looping patternsrisk — error handlingspawn() — concurrencyneed — importssection — code organisationon / off — booleansvoid — null / nothingstart — on when run directly.force — push through obstaclesreach() — HTTP clientwrite() — print to stdoutCopyright ©2026 Thorn Language Project. All Rights Reserved