stack docs
this is a stack language. values are separated by spaces. integers are precise and can be infinitely large, floats are not. strings are enclosed by "" and use \ as an escape character (the next character after \ will be interpreted literally; \n etc. won't work).
a bunch of values and ops enclosed in brackets creates a substack. ops in substacks won't be immediately run. all the values in a substack can be pushed to the stack with `, and a value can be placed in a substack with '.
operations
arithmetic (6)
integer arithmetic rounds down. adding decimal points to numbers makes them floats.
- +: add
- -: subtract
- *: multiply
- /: divide
- %: mod
- ^: exp
might add trig at some point.
booleans (3)
true, when unquoted, deletes the second-top value; false, when unquoted, deletes the top value.
- T: true
- F: false
- _: empty (returns true on 0, empty string, empty stack)
comparisons (6)
these use the same boolean thingys.
- =: equality (for numbers and strings)
- <: less than
- >: greater than
- <>: inequality (for numbers and strings)
- <=: less than or equal to
- >=: greater than or equal to
stack ops (9)
these are for handling the stack and substacks.
- #: concatenate two substacks
- ~: swap the top two items
- ?: drop the top item
- !: duplicate the top item (may be bugged due to javascript)
- ': put the top item in a substack
- `: unquote the top substack, pushing all its values to the stack and calling all its operations
- (: move the top item of the stack to the bottom
- ): move the bottom item of the stack to the top
- @: rotate the top three stack items one spot forward (1 2 3 @ -> 3 1 2 @)
projects home