Operator precedence (Vitte 1.0)

This table corresponds to the current parser in src/compiler/frontend/parser.vit. The tallest lines have the strongest bond.

  1. Postfix: call f(x), index a[b], member a.b, deref postfix a.*
  2. Unary: not / !, unary -, address &, deref *
  3. Cast: as
  4. Multiplicative: * / %
  5. Additive: + -
  6. Shift: << >>
  7. Relational: < <= > >=
  8. Equality: == != and pattern test is
  9. Bitwise AND: &
  10. Bitwise XOR: ^
  11. Bitwise OR: |
  12. Logical AND: and &&
  13. Logical OR: or ||
  14. Assignment: =

Notes:

  • as is parsed before any binary operator, so it binds stronger than comparisons and arithmetic.
  • is is treated at the same priority level as equality.
  • The assignment is right-associative (a = b = c is parsed as a = (b = c)).