First revision of operators
This commit is contained in:
parent
965d322405
commit
f796a43c16
81
doc/operators.txt
Normal file
81
doc/operators.txt
Normal file
@ -0,0 +1,81 @@
|
||||
A higher precedence operator becomes an operand for a lower precedence one.
|
||||
Higher precedence operators get resolved first.
|
||||
|
||||
Operators in Pivot:
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| Precedence | Operator | Description | Operands | Associativity |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 16 | () | Grouping | internal | n/a |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 15 | . | Member Access | dual | Left to Right |
|
||||
| 15 | [] | Computed Member Access | before, internal | Left to Right |
|
||||
| 15 | () | Function Call | before, internal | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 14 | let | Variable Creation | after | Right to Left |
|
||||
| 14 | const | Constant Creation | after | Right to Left |
|
||||
| 14 | new | Object Creation | after | Right to Left |
|
||||
| 14 | () {} | Function Creation | internal | n/a |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 13 | ++ | Postfix Increment | before | Left to Right |
|
||||
| 13 | -- | Postfix Decrement | before | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 12 | ! | Logical NOT | after | Right to Left |
|
||||
| 12 | - | Unary Negation | after | Right to Left |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 11 | ** | Exponentiation | dual | Right to Left |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 10 | * | Multiplication | dual | Left to Right |
|
||||
| 10 | / | Division | dual | Left to Right |
|
||||
| 10 | % | Modulus | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 9 | + | Addition | dual | Left to Right |
|
||||
| 9 | - | Subtraction | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 7 | < | Less Than | dual | Left to Right |
|
||||
| 7 | <= | Less Than or Equal | dual | Left to Right |
|
||||
| 7 | > | Greater Than | dual | Left to Right |
|
||||
| 7 | >= | Greater Than or Equal | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 6 | == | Equality | dual | Left to Right |
|
||||
| 6 | != | Inequality | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 4 | && | Logical AND | dual | Left to Right |
|
||||
| 4 | ^^ | Logical XOR | dual | Left to Right |
|
||||
| 4 | || | Logical OR | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 3 | = | Assignment | dual | Right to Left |
|
||||
| 3 | += | Add and Assign | dual | Right to Left |
|
||||
| 3 | -= | Subtract and Assign | dual | Right to Left |
|
||||
| 3 | **= | Exponentiate and Assign | dual | Right to Left |
|
||||
| 3 | *= | Multiply and Assign | dual | Right to Left |
|
||||
| 3 | /= | Divide and Assign | dual | Right to Left |
|
||||
| 3 | %= | Modulo and Assign | dual | Right to Left |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 2 | , | Comma | none | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 1 | ; | Statement End | before | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
|
||||
Possible Operators in Pivot:
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| Precedence | Operator | Description | Operands | Associativity |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 12 | ~ | Bitwise NOT | after | Right to Left |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 8 | << | Bitwise Left Shift | dual | Left to Right |
|
||||
| 8 | >> | Bitwise Right Shift | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 5 | and | Logical AND | dual | Left to Right |
|
||||
| 5 | xor | Logical XOR | dual | Left to Right |
|
||||
| 5 | or | Logical OR | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 5 | & | Bitwise AND | dual | Left to Right |
|
||||
| 5 | ^ | Bitwise XOR | dual | Left to Right |
|
||||
| 5 | | | Bitwise OR | dual | Left to Right |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
||||
| 3 | <<= | Bitwise Left Shift and Assign | dual | Right to Left |
|
||||
| 3 | >>= | Bitwise Right Shift and Assign | dual | Right to Left |
|
||||
| 3 | &= | Bitwise AND and Assign | dual | Right to Left |
|
||||
| 3 | ^= | Bitwise XOR and Assign | dual | Right to Left |
|
||||
| 3 | |= | Bitwise OR and Assign | dual | Right to Left |
|
||||
+-------------+------------+----------------------------------+--------------------+-----------------+
|
Loading…
x
Reference in New Issue
Block a user