-
Notifications
You must be signed in to change notification settings - Fork 2
Commands
In these explanations, "the stack" refers to the current stack pointed to by the stack pointer.
i - Take in a byte of input as its ASCII value and push it to the stack. If there is no more input to take in, push 0.
n - Take in a space-separated portion of input as a raw number and push it to the stack.
o - Pop one number from the stack, turn it into the character with that ASCII value, and print it.
u - Pop one number from the stack, and print it.
r - Reverse the stack.
: - Duplicate the top value on the stack.
f - Flip the position of the two highest values on the stack.
! - Pop a number from the stack. If it is 0, push 1. Otherwise, push 0.
p - Pop a number from the stack.
> - Create another stack to the right of the current stack, or move to an existing one.
< - Create another stack to the left of the current stack, or move to an existing one.
y - Push the length of the stack to the stack.
" - String literals; push the ASCII value of every character after the quote to the stack until another quote is met.
0-9 - Digit literals; push the digit to the stack. Multi-digit numbers can be pushed if they are surrounded with parentheses.
+, -, *, /, % - Pop X and Y off the stack, then push Y operator X.
? - Pop X and Y off the stack, the push a random integer between Y and X.
= - Pop a number from the stack, then push 1 if the top value on the stack is equal to that number, and 0 otherwise.
[ - If the top of the stack is 0 or the stack is empty, skip the execution pointer to the corresponding ]. Otherwise, do nothing.
] - If the top of the stack is not 0 and the stack is not empty, move the execution pointer back to the corresponding [. Otherwise, do nothing.
$ - Pop a number from the stack and break out of that many layers of loops. Breaking out of a loop will place the execution pointer immediately after the end of the loop.
s - Save the top of the stack to the backup cell. This does not pop from the stack.
l - Take the current value of the backup cell, and push it to the stack. The backup cell will not lose its value.
; - End execution. This instruction is only required to end execution early; it is not required to add it at the end of every program.