Operator Precedence
Expression operators bind as in cambrian-transpiler/src/cambrian.lalrpop
(lowest to highest). All listed binary operators are left-associative.
| Level | Operators | Notes |
|---|---|---|
| 1 | || | Logical or |
| 2 | && | Logical and |
| 3 | | | Bitwise or — not route/action syntax |
| 4 | ^ | Bitwise xor — not temporal ^member |
| 5 | & | Bitwise and |
| 6 | == != | Equality |
| 7 | < > <= >= | Ordering |
| 8 | << >> | Shifts |
| 9 | + - +% -% | Checked / wrapping add & sub |
| 10 | * / % *% | Checked / wrapping mul, div, mod |
| 11 | as Type | Cast (chains left: x as u64 as U256) |
| 12 | ! - * | Unary not, negation, dereference |
| 13 | .field .method() [index] | Postfix access |
| 14 | Primary | Literals, ^member, @macro(), msg::, sys::, calls |
Not expression operators
These appear in routes, transforms, or actions — they do not participate in the expression precedence chain above:
| Form | Role |
|---|---|
=> | Route body, transform, match arm, action-level for |
~> | Send / transfer action |
with { … } | Send / deploy options after ~> |
Temporal ^member
^m_count is parsed as a primary expression (prefix on a member name).
It is unrelated to bitwise xor between two ordinary expressions.
Send options use with { value: … } after ~> dest. See Send Messages.
For the full grammar, see cambrian-transpiler/src/cambrian.lalrpop (ExprOr
through ExprPrimary).