StackLang
Jump to navigation
Jump to search
StackLang is a Stack-based esoteric programming language made by Dominicentek. StackLang executes it's instructions depending on a value in the stack.
Execution
Each line is pushed onto the stack. The line is converted into a number that will be pushed. If it cannot be converted into a number, it pushes a string onto the stack. Once all lines are pushed. The interpretation of the program begins. Each instruction value is popped once it starts executing another instruction. The stack is also used as a data stack, too.
Instructions
Instruction | Description |
---|---|
0 | Prints the top value and pops it |
1 | Loop, the top value of the stack is used for loop amount, when it reaches the bottom of the stack, it loops |
2 | Infinite loop, when it reaches the bottom of the stack, it loops |
3 | Breaks out of a loop |
4 | Continue a loop |
5 | Pushes the top value onto a stack twice (Duplicate) |
6 | Pops the top value of the stack |
7 | Gets user input and pushes it onto the stack |
8 | If statement, if the top value matches the value below it, it continues, otherwise it skips amount of values defined by 3rd top value in the stack. Compared values will be popped. |
9 | Moves the value below this instruction to the top |
10 | Moves the pointer to the top |
11 | Moves the pointer based on the top value of the stack, then pops it |
12 | Exits out of the program |
Examples
Hello World
Hello, World! 0
Truth-machine
0 0 4 0 5 5 2 5 1 9 12 0 0 0 3 0 8 7
Cat Program
0 7