StackPoint
A tape of numbers, and a stack of places on it. The top of the stack is where you are.
ChuckEsoteric08 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
ChuckEsoteric08 made StackPoint after Bub and the CINS language. It has a tape of whole numbers, like brainfuck, but no tape head. The head is the number on top of a stack. > and < move it by changing that number, and " and * push a second head to come back to later.
Read the story
Jumps go to labels. A label is a name of lowercase letters and digits, declared with name:. name^ jumps there when the current cell is 0 and name@ when it is not.
The machine
| Command | Does |
|---|---|
> < | Add 1 to or take 1 from the top of the stack |
~ # | Swap the top two; drop the top |
" * | Duplicate the top; push 0 |
& | Reverse the stack |
+ - | Add 1 to or take 1 from the current cell |
, . | Read a byte into the current cell; print it |
name: | Declare a label |
name^ name@ | Jump to it when the current cell is 0, or when it is not |
The stack starts as one 0. This implementation reads the end of input as 0, skips whitespace and stops on any other character.
Example
A cat program.
A cat program. It stops on a 0 byte, and also at the end of the input.
The truth machine puts 48 and 49, the characters 0 and 1, in cells 0 and 1, and the input minus 48 in cell 2. On 0 it moves the head back to cell 0 and prints it once.
Patterns it teaches
- Turing tarpit: brainfuck's tape with its head kept on a stack.
Further
See also
Cell-based
Stack-based
Write your own in Run Convert a program from StackPoint
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: stackpoint.
Command line
shib run stackpoint -e 'repeat:
,
halt^
.
repeat@
halt:' --input 'Hi '