Reference: operator precedence
Reference: operator precedence
Section titled “Reference: operator precedence”Normative implementation: crates/vox-compiler/src/parser/descent/expr/pratt_ops.rs (infix_bp and postfix ? handling).
Binding strength (loose → tight)
Section titled “Binding strength (loose → tight)”Higher binding power means the operator groups more tightly with its operands.
| Precedence (conceptual) | Operators / forms | Notes |
|---|---|---|
| 1–2 | |> pipe | Left-associative chain: a |> f |> g |
| 3–4 | or | Phonetic logical OR |
| 5–6 | and | Phonetic logical AND |
| 5–6 | with (expression form) | Parsed as infix between operand and options block |
| 7–8 | is, isnt, ==, != | Equality-style (EqEq / NotEq tokenized same as is / isnt) |
| 9–10 | <, >, <=, >= | Ordering comparisons |
| 11–12 | +, - | Arithmetic |
| 13–14 | *, /, % | Arithmetic multiplicative |
| Postfix (tight) | ? | Try / early-return on Option / Result |
Unary not and primary expressions are parsed before binary operators (see parser descent).
Unary and unary-like forms
Section titled “Unary and unary-like forms”- Prefix
notapplies to the following primary expression; combine with parentheses when mixing withand/or.