Stakr
Jump to navigation
Jump to search
A minimalistic, stack-based language. Operates on a stack and memory array, with simple symbols for operations.
Made by ChatGPT.
Features
- Stack-based operations.
- Memory: simple array of bytes.
- Instructions: single symbols or combinations.
- Executed line by line.
Instructions
Symbol | Operation | Notes |
---|---|---|
^ |
push number | Push the next number literal onto the stack |
v |
pop | Remove top of stack |
+ |
add | Pop two, push sum |
- |
subtract | Pop two, push difference (second-first) |
* |
multiply | Pop two, push product |
/ |
divide | Pop two, push quotient (second/first) |
~ |
swap | Swap top two stack values |
? |
duplicate | Duplicate top value |
> |
store | Pop value, pop address, store value at memory[address] |
< |
load | Pop address, push memory[address] |
[ |
start loop | If top of stack ≠ 0 |
] |
end loop | End Loop |
. |
Pop and print as number | |
, |
input | Input number and push |
; |
comment | Self Explanatory |
6. Example
^5 ^3 + . ; Push 5, push 3, add, print → outputs 8