Operator Precedence
Expression operators#
Lowest binding at the top, highest at the bottom.
| Level | Operators | Description | Associativity |
|---|---|---|---|
| 1 | <=> | Biconditional | left |
| 2 | => | Implication | left: a => b => c is (a => b) => c |
| 3 | ||, or | Disjunction | left |
| 4 | &&, and | Conjunction | left |
| 5 | !, not | Negation | prefix; looser than comparisons: !a == b is !(a == b) |
| 6 | == != < <= > >= in subset <u <=u >u >=u <s <=s >s >=s | Comparison, membership | none: a < b < c is an error |
| 7 | + - | Addition, subtraction | left |
| 8 | * / % *u /u %u *s /s %s | Multiplicative | left |
| 9 | & | ^ | Bitwise (tighter than *) | left |
| 10 | << >> >>> | Shifts (tightest binary) | left |
| 11 | - ~ | Unary minus, complement | prefix |
| 12 | literals, names, calls, a[i], a.f, ( … ), if … then … else …, quantifiers, lambda, extract<hi, lo>(e), Memory<N>(a) | Primary | — |
A quantifier body and the else branch of a conditional extend as far to the right as possible: forall (i : Int) in [0..n) . a && b quantifies over a && b.
Behavior operators#
| Level | Operator | Notes |
|---|---|---|
| 1 | P || Q | Parallel, lowest |
| 2 | P + Q | Choice |
| 3 | a . P, [c] P, P * | Prefix (right-associative); a guard covers one prefix chain; * applies to the term just before it |
| 4 | actions, names, terminals, ( … ), atomic { … }, branch … | Atoms |
See Process Calculus.