aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md32
1 files changed, 31 insertions, 1 deletions
diff --git a/README.md b/README.md
index 6de0103..2e48017 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,6 @@ The following things use pool entries:
- All keywords (except block definers like loops) should cleanly stop parsing
at the first keyword they don't recognize. This will enable things like
IF...THEN...ELSE
-- Add leftshift, rightshift operators
- It'd be cool if `ls_minify` could access full idents beyond `LS_IDENT_LEN`;
the number of possible minified six-letter idents is enormous (about 52
billion if I did the math right) so if you're always going to minify idents
@@ -254,6 +253,37 @@ COMn [speed] [parity] [data]
FILE device /path/to/file
```
+## Operators
+
+The following operators are supported, with higher precedence values binding
+more tightly:
+
+| **OPER** | **PREC** | **OPERATION ** |
+|:---------:|---------:|----------------|
+| `ABS n` | 13 | Absolute value of n |
+| `NOT n` | 13 | Bitwise inverse of n |
+| `-n` | 13 | Negation of n |
+| `x * y` | 12 | Multiplication of x by y |
+| `x / y` | 12 | Division of x by y |
+| `x % y` | 12 | Remainder of x divided by y |
+| `x + y` | 11 | Addition of x and y |
+| `x - y` | 11 | Subtraction from x of y |
+| `x << y` | 10 | Shift of x left by y bits. If y < 0, shift right. |
+| `x >> y` | 10 | Shift of x right by y bits. If y < 0, shift left. |
+| `x < y` | 9 | Comparison of x < y |
+| `x > y` | 9 | Comparison of x > y |
+| `x <= y` | 9 | Comparison of x ≤ y |
+| `x >= y` | 9 | Comparison of x ≥ y |
+| `x = y` | 8 | Comparison of x = y |
+| `x <> y` | 8 | Comparison of x ≠ y |
+| `x and y` | 7 | Bitwise AND of x with y |
+| `x xor y` | 7 | Bitwise XOR of x with y |
+| `x or y` | 7 | Bitwise OR of x with y |
+| `x eqv y` | 7 | Bitwise equivalency of x and y (`not (x xor y)`) |
+| `x imp y` | 7 | Bitwise implication of x and y (`not (x and not y`) |
+
+The operator precedence is based on that of C.
+
## Statements
(More verbose documentation is provided below, when useful)