Skip to content
This repository was archived by the owner on Jul 9, 2022. It is now read-only.

Commands

LyricLy edited this page Jul 18, 2017 · 28 revisions

In these explanations, "the stack" refers to the current stack pointed to by the stack pointer.

I/O

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.

Stack manipulation

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.

> - 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.

Literals

" - 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.

Operators

+, -, *, /, % - Pop X and Y off the stack, then push Y operator X.

Loops

[ - 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.

Backup cell

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.

Misc

; - End execution. This instruction is only required to end execution early; it is not required to add it at the end of every program.

Clone this wiki locally