Spec

Types

numf64
inti64
strstring
boolboolean
voidno value

Keywords

fnfunction
retreturn
typetype definition
ifconditional
letbinding
callfunction call
oksuccess
errerror
orunion separator

Operators

plus+
minus-
times*
over/
mod%
eq==
neq!=
lt gt lte gte< > <= >=
and or notlogical

Positional

firstparam 0
secondparam 1
thirdparam 2
fourthparam 3

Numbers

zero one two three four five six seven eight nine ten

Syntax

Function

fn name params...
body

Return

ret value
ret ok value
ret err value

Type

type name fields...
type name ok type or err type

Conditional

if condition statement

Binding

let name value

Call

call function args...

Examples

Math

fn add a b
ret a plus b

fn sub a b
ret a minus b

Calculator

type result ok num or err str

fn calc a b op
if op eq zero ret ok a plus b
if op eq one ret ok a minus b
ret err "unknown"

Function Calls

fn square x
ret x times x

fn hypotenuse a b
let asq call square a
let bsq call square b
ret math sqrt asq plus bsq

Comments

-- this is a comment
# this too

Compilation

NERD → Lexer → Parser → AST → LLVM IR → clang → native