Table 3-1. JALv2 Operators
| Operator | Operation | Result |
|---|---|---|
| COUNT | returns the number of elements in an array | UNIVERSAL |
| WHEREIS | return the location of an identifier | UNIVERSAL |
| DEFINED | determines if an identifier exists | BIT |
| '(' expr ')' | Grouping | Result of evaluating expr |
| '-' | Unary - (negation) | Same as operand |
| '+' | Unary + (no-op) | Same as operand |
| '!' | 1's complement | Same as operand |
| '!!' | Logical. If the following value is 0, the result is 0, otherwise the result is 1. | BIT |
| '*' | Multiplication | Promotion2 |
| '/' | Division | Promotion2 |
| '%' | Modulus division (remainder) | Promotion2 |
| '+' | Addition | Promotion2 |
| '-' | Subtraction | Promotion2 |
| '<<' | Shift left | Promotion2 |
| '>>'1 | Shift right | Promotion2 |
| '<' | Strictly less than | BIT |
| '<=' | Less or equal | BIT |
| '==' | Equality | BIT |
| '!=' | Unequal | BIT |
| '>=' | Greater or equal | BIT |
| '>' | Strictly greater than | BIT |
| '&' | Binary AND | Promotion2 |
| '|' | Binary OR | Promotion2 |
| '^' | Binary exclusive OR | Promotion2 |
1shift right: If the left operand is signed, the shift is arithmetic (sign preserving). If unsigned, it is a simple binary shift.
2promotion: The promotion rules are tricky, here are the cases:
| If one of the operands is UNIVERSAL and the other is not, the result is the same as the non-UNIVERSAL operand. |
| If both operands have the same signedness and width, the result is that of the operands. |
| If both operands have the same width, and one is unsigned, the result is unsigned. |
| If one operand is wider than the other, the other operand will be promoted to the wider type. |