One aspect of parsing precedence is associativity. A left-associative operator is one, such as *, with the property that x * y * z is parsed as (x * y) * z. A right-associative operator is one, such as =, with the property that x = y = z is parsed as x = (y = z). These operators are left associative: # #? % & * ** + ++ , - . .. ..< .? / // << @@ ^ ^** ^< ^<= ^> ^>= ^^ _ _< _<= _> _>= | |_ || · (missing documentation) ⊠ (missing documentation) ⧢ (missing documentation) , and these operators are right associative: != %= &= **= *= ++= += -= -> ..<= ..= //= /= : := ; < <- <<= <= <== <=== <==> <==>= = =!= == === ===> ===>= ==> ==>= => > >= >> >>= ? ?? ??= @ @= @@= \ \= \\ \\= ^**= ^= ^^= _= |- |-= |= |_= ||= ·= ⊠= ⧢= and or SPACE xor .
Here are the operators arranged in order of increasing parsing precedence. For example, * has higher parsing precedence than +, and hence 2+3*5 is parsed as though it had been written as 2+(3*5). The symbol SPACE represents the operator that is used when two things are adjacent in program code.
8 ; 10 , 14 %= &= **= *= ++= += -= -> ..<= ..= //= /= := <- <<= <==>= = ===>= ==>= => >> >>= ??= @= @@= \= \\= ^**= ^= ^^= _= |-= |= |_= ||= ·= ⊠= ⧢= 18 << 20 |- 22 <=== ===> 24 <==> 26 <== ==> 28 ?? or 30 xor 32 and 34 not 36 != < <= =!= == === > >= ? 38 || 40 : 42 | 44 ^^ 46 & 48 .. ..< 50 + ++ - 52 · 54 ** ⊠ ⧢ 58 % * / // \ \\ 60 @ 62 SPACE 64 (*) 66 @@ 68 ^* ^~ _* _~ ~ 70 # #? . .? ^ ^** ^< ^<= ^> ^>= _ _< _<= _> _>= |_ 72 ! ^! _! |
The source of this document is in Macaulay2Doc/ov_language.m2:1150:0.