Expressions & operators
An expression produces a value. This family is the operator stack:
assignment at the root, then or and and, then comparison and
arithmetic, then calls, members, and the literals — numbers, strings,
true / false / null, lists, tuples, and inline JSON.
← stores a value at run time. and / or / not are the boolean
words. coalesce is the nullish default: if the left side is null, the
value is the right side. A "…" literal with § holes is a template;
the parentheses after it supply the arguments, which is not a function
call.
fn greet(string nomen) → string {
return "Salve, §!"(nomen)
}
main {
let i32 a ← 7
let i32 b ← 2
print a / b
print a ≥ b and b ≢ 0
print greet("munde")
}coalesce fills in a missing value:
main {
let i32 ∪ none missing ← null
let i32 n ← missing coalesce 0
print n
}Return to the grammar overview.
Terms#
These are the words you write in this part of the language. Each links to its page. The second column names the grammar rule the word belongs to.
| Term | Grammar rule |
|---|---|
or | aut_expr |
and | et_expr |
is, is, not | equality_tail |
before, step, until | range_tail |
coalesce | vel_expr |
before, step, until | vel_range_tail |
not | unary_expr |
spread | argument |
ref, mut | call_marker |
spread | template_argument |
false, null, true | literal |
self | primary |
call | ad_expr |
tuple | iuncta_expr |
from | construction_source |
variant | finge_expr |
comptime | praefixum_expr |
format | scriptum_expr |
read, line | lege_expr |
from | reducta_expr |
all, sum | reducta_op |
per | reducta_group |
let, mut | reducta_body |
coalesce | reducta_identity |
from, let | scan_expr |
all, sum | scan_op |
per | scan_group |
ref, from | sort_expr |
let, mut | sort_body |
Formal grammar#
The rules for this part of the language are the parser's own definition of it. They are written for models and tools, so this page does not repeat them; the full list is at every production.