Skip to main content

Module expr

Module expr 

Source
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)

LevelOperators
1||
2&&
3|
4^
5&
6==, !=
7<, <=, >, >=
8<<, >>
9+, -
10*, /, %
11unary -, !, ~
12primary 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.

Enums§

BinaryOp
Binary operators, grouped by category.
ExprKind
The variant and payload of an Expr.
Lit
A literal value — the base case of the expression grammar.
UnaryOp
Unary operators.