Expand description
Precedence-climbing expression parser.
Expressions are parsed via a hand-written recursive-descent chain that encodes operator precedence through the call stack. From lowest to highest:
parse_expression (entry point, delegates to equality)
|- parse_logical (and or)
|- parse_equality (== !=)
|- parse_comparison (< <= > >= += -= *= /=)
|- parse_term (+ -)
|- parse_factor (* /)
|- parse_unary (! -)
|- parse_primary (literals, identifiers, calls, lambdas, โฆ)
|- parse_postfix (. method chains)Every function returns an [Expression] node with its source [Span] set
to the full extent of the sub-expression it consumed.
Modulesยง
- comparsion ๐
- equality ๐
- factor ๐
- logical ๐
- postfix ๐
- primary ๐
- struct_
literal ๐ - Record (struct) literal parser:
Name { field: value, ... }. - term ๐
- unary ๐