aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-20 22:57:11 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-20 22:57:11 -0800
commit0184e51377ebb5e398748f03552abe4168d359f3 (patch)
tree0ae98e7eb4cce00c30e645c12d840cab50ddb508 /README.md
parent479df1ff2ab4a6cf8f7a42b9b6f4fa4c403590ff (diff)
fix memory leak
Diffstat (limited to 'README.md')
-rw-r--r--README.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index cd1c919..850b2a5 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,9 @@ about memory allocation while the implementation remains extremely simple.
install `doxygen` as an optional dependency. If you are on a BSD or MacOS, you
must use `gmake`.
+# Documentation
+Builtin function definitions and the C API in general are documented [here](https://stemdoc.nullring.xyz).
+
# Quickstart
Because this is a stack based language, all operations are done in reverse polish. For example, to add two numbers together:
```
@@ -26,12 +29,12 @@ to the action of adding two numbers when called.
Let's look at a real example of a REPL implementation in this language:
```
-repl [ "> " . read strquote eval repl ] func
+repl [ "> " . read strquote eval repl ] def
repl
```
`repl` is a word, which means it is a literal, and everything that is a literal gets pushed onto the stack.
-Everything between the `[` and `]` is an element in a quote. Then, we see the `func` word. If a word is already bound to a function,
-the function gets called instead of getting pushed to the stack, so the `func` function gets called, which takes the top two
+Everything between the `[` and `]` is an element in a quote. Then, we see the `def` word. If a word is already bound to a function,
+the function gets called instead of getting pushed to the stack, so the `def` function gets called, which takes the top two
elements off the stack, and creates a function called `repl` where now every time `repl` is called in the future, the quote is evaluated
instead.
@@ -46,5 +49,5 @@ does, and then finally `repl` gets called again at the end so we can loop foreve
## Factorial
Let's take a closer look at the factorial function:
```
-
+factorial [ dup 0 <= [ 1 + ] [ dup 1 - factorial * ] if ] def
```