Its like Porth, but in Rust. Project inspired by Tsoding's Porth series on Youtube.
$ cargo run sim examples/stack.rorth
$ cargo run com -r -s examples/stack.rorth
- Compiled to a native instruction set (only Apple Silicon arm64 for now)
- Turing-complete
- Statically typed (the type checking is inspired by WASM validation)
- Self-hosted
- Optimized
- Crossplatform
Name | Signature | Description |
---|---|---|
dup |
a -- a a |
duplicate an element on top of the stack. |
swap |
a b -- b a |
swap 2 elements on the top of the stack. |
drop |
a b -- a |
drops the top element of the stack. |
print |
a b -- a |
print the element on top of the stack in a free form to stdout and remove it from the stack. |
write |
str fd len -- |
prints a number of characters from a string to a fd and removes all three params after. |
over |
a b -- a b a |
copy the element below the top of the stack |
rot |
a b c -- b c a |
rotate the top three stack elements. |
Name | Signature | Description |
---|---|---|
= |
[a: int] [b: int] -- [a == b : bool] |
checks if two elements on top of the stack are equal. |
> |
[a: int] [b: int] -- [a > b : bool] |
checks if a is greater than b. |
< |
[a: int] [b: int] -- [a < b : bool] |
checks if a is less than b. |
Name | Signature | Description |
---|---|---|
+ |
[a: int] [b: int] -- [a + b: int] |
sums up two elements on the top of the stack. |
- |
[a: int] [b: int] -- [a - b: int] |
subtracts two elements on the top of the stack. |
* |
[a: int] [b: int] -- [a * b: int] |
multiplies two elements on the top of the stack. |
/ |
[a: int] [b: int] -- [a / b: int] |
divides two elements on the top of the stack. |