Stackylogic
Jump to navigation
Jump to search
Stackylogic is a stack-based programming language where every line is a stack of bits. It was created by Calvin's Hobbies on the Programming Puzzles & Code Golf Stack Exchange as a code golf challenge (here). A program contains only 4 characters: 0, 1, ? and <. Each line is a stack, with its top on the right, and bottom on the left, and can contain any number of 0, 1, or ? characters. Additionally, exactly one (non-empty) line must end with <.
every program includes one implicit empty stack before the first and after the last line.
The execution pointer starts at the stack with the <. Every cycle, it pops one bit off the current stack.
- If it pops a ?, it takes a 0 or 1 from user input, and acts as if it had been in place of the ?.
- If it pops a 0, it moves one stack up (to the line above).
- If it pops a 1, it moves one stack down (to the line below).
- If the current stack is empty, it returns the last bit popped, and exits.
It is not turing complete, as all programs must terminate (when all stacks are empty).