From c484b2fe3bbfffaa0509f919972dd25a35e82ad7 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 17 Apr 2017 20:35:55 +0200 Subject: Add word documentation to README.md --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 83cb867..b1d220d 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,29 @@ § loop i withinBounds if i print i incr loop then else ; loop -The above _slang_ code to be entered in the repl prints the numbers from 1 to 9. The repl may be compiled and executed using `dub run` in the project directory. +The above _slang_ code to be entered in the repl prints the numbers from 1 to 9. The repl may be compiled and executed using `dub run` in the project directory. Check the `example` directory for further further demonstrations. + +## Words + +Currently implemented primitives: + +| Word | Description | +| --- | --- | +| `§` | Custom word definition | +| `$`, `@` | Single token variable binding, resolution | +| `if`, `then`, `else` | Conditional primitives | +| `+`, `*`, `/`, `%` | Common artithmetics | +| `.` | Non destructive printing of top-of-stack | +| `pop` | Remove uppermost stack element | +| `dup` | Duplicate top-of-stack | +| `swp` | Swap the first two stack elements | +| `over` | Place a copy of the second stack element on top-of-stack | +| `rot` | Rotate the top three stack elements | +| `true` | Write true boolean value to top-of-stack | +| `false` | Write false boolean value to top-of-stack | +| `!` | Negate boolean value | +| `<` | Compare size of two integers | +| `=` | Compare equality of two stack values | +| `&` | Boolean and | +| `or` | Boolean or | +| `#` | Debug word printing the whole stack to _stdout_ | -- cgit v1.2.3