When an expression contains more than one operator, Hades must decide which operations to perform first. That decision is controlled by two properties: precedence (which operator binds more tightly) and associativity (how operators of equal precedence chain together). The table below lists all operator groups from lowest precedence (level 1) to highest (level 10), exactly as encoded in the parser’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt
Use this file to discover all available pages before exploring further.
BINARY_PRECEDENCE table and the language grammar.
Higher-numbered levels bind more tightly. An expression like
a + b * c is parsed as a + (b * c) because * (level 6) outranks + (level 5). Use parentheses to override the default grouping.Precedence Table
| Level | Group | Operators | Associativity |
|---|---|---|---|
| 1 | Assignment | =, +=, -=, *=, /=, %=, &&=, ||=, ^^= | Right |
| 2 | Logical OR / XOR | ||, ^^ | Left |
| 3 | Logical AND | && | Left |
| 4 | Equality | ==, !=, ===, !== | Left |
| 5 | Comparison | <, >, <=, >=, in | Left |
| 6 | Additive | +, - | Left |
| 7 | Multiplicative | *, /, % | Left |
| 8 | Unary (prefix) | !, -, + | Right (recursive) |
| 9 | Postfix | ++, -- | Left |
| 10 | Primary | literals, identifiers, (expr), calls, -> indexing | — |
Level-by-Level Reference
Level 1 — Assignment (lowest precedence)
Level 1 — Assignment (lowest precedence)
Assignment is right-associative and has the lowest precedence of all operators, meaning the entire right-hand side is evaluated first.Operators: Because assignment is right-associative, chained assignments (where supported) evaluate right-to-left:
=, +=, -=, *=, /=, %=, &&=, ||=, ^^=Level 2 — Logical OR and XOR
Level 2 — Logical OR and XOR
Operators:
|| (OR), ^^ (XOR)Both operators share precedence level 2 and are left-associative. They evaluate operands using truthiness — any non-zero, non-empty, non-nothing value is treated as TRUE.Level 3 — Logical AND
Level 3 — Logical AND
Operator:
&&AND binds more tightly than OR/XOR, so a || b && c is parsed as a || (b && c).Level 4 — Equality
Level 4 — Equality
Operators:
==, !=, ===, !==== and != compare values only; === and !== compare both type and value.Level 5 — Comparison and Membership
Level 5 — Comparison and Membership
Operators:
<, >, <=, >=, inThe in operator tests whether the left-hand value is contained in the right-hand list or string.Level 6 — Additive
Level 6 — Additive
Operators:
+, -Left-associative. + also concatenates strings.Level 7 — Multiplicative
Level 7 — Multiplicative
Operators:
*, /, %Left-associative. These bind more tightly than + and -.Level 8 — Unary Prefix
Level 8 — Unary Prefix
Operators:
! (logical NOT), - (negation), + (absolute value)Unary operators are right-recursive, meaning !!x is !(!x).Level 9 — Postfix (++ and --)
Level 9 — Postfix (++ and --)
Operators:
++, --Postfix increment and decrement have very high precedence and update the variable in place. The expression evaluates to the old value before the update is applied.Level 10 — Primary (highest precedence)
Level 10 — Primary (highest precedence)
Highest-precedence constructs include: numeric and string literals, boolean literals, identifiers, function calls (
name(args)), list indexing (list -> index), and parenthesized sub-expressions.Parentheses can be used anywhere to force a specific grouping: