<stack>
Brainfuck's loops on a stack of bytes, spelled with the letters of its own name.
None1, 2023 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
None1 named the language after its seven commands, <, s, t, a, c, k and >. So the name is itself a program, one that does nothing. The commands work like brainfuck's, but on a stack instead of a tape. You can only add to the top and only look at the top, so it is a push down automaton and not Turing complete.
The machine
The stack starts as one 0 and never empties.
| Command | Does |
|---|---|
s | Push 0 |
t | Read a byte and push it; 0 at the end of the input |
a | Add 1 to the top; 255 wraps to 0 |
c | Print the top and pop it |
k | Pop |
< > | Loop while the top is not 0, as brainfuck's [ ] |
c and k do nothing while the stack holds a single item. Every other character is ignored.
Example
Each letter is one s, as many a as its code and one c.
Each letter is one s, as many a as its code and one c. The line reverser reads bytes and adds 246 to each, so a line feed becomes 0 and ends the loop. Then it pops that 0, adds 10 back to each byte and prints them from the top down.
Further
Ideas it shows
See also
<stack> builds on Brainfuck.
Brainfuck derivatives
Stack-based
Write your own in Run Convert a program from <stack>
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: lstackg.
Command line
shib run lstackg -e '<stack>'shib manual lstackgSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/lstackg.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org