Expand description
Expression AST nodes for the Fiducia expression language.
§Grammar
e ::= v -- literal
| x -- variable reference
| alias.fn(args) -- function call
| sizeof(T) -- size of type T
| uop e -- unary
| e binop e -- binary
| e.field -- field access (base restricted to
a variable, call, or field chain)
v ::= int_lit -- decimal integer, e.g. 42
| hex_lit -- hex integer, e.g. 0xFF
| bool_lit -- true | false
uop ::= - | ! | ~
binop ::= + | - | * | / | %
| == | != | < | <= | > | >=
| && | ||
| & | | | ^ | << | >>§Operator precedence (loosest → tightest)
| Level | Operators |
|---|---|
| 1 | || |
| 2 | && |
| 3 | | |
| 4 | ^ |
| 5 | & |
| 6 | ==, != |
| 7 | <, <=, >, >= |
| 8 | <<, >> |
| 9 | +, - |
| 10 | *, /, % |
| 11 | unary -, !, ~ |
| 12 | primary atoms |
Language reference: Expressions.
Structs§
- CExpr
- Function call expression:
alias '.' fn_name '(' args ')'. - Expr
- A Fiducia expression: a node kind together with its source byte range.