Pops Are Overrated
A stack language with no command to pop. Plus subtracts, minus adds, and printing leaves the value where it was.
AmNow, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
AmNow made Pops Are Overrated, PAO for short, in 2021. Memory is a row of stacks with a pointer to one of them. Commands push, combine, copy and move values, but none of them throws the top away.
Read the story
To get rid of a value you compute it away, or move it onto the next stack with >. The stack pop cheat %+- copies the top, subtracts the copy from it and adds the 0 to the value below.
The four sums wear each other's signs. + subtracts, - adds, / multiplies and * divides.
The machine
| Command | Does |
|---|---|
€ | Push 0 |
0 to 9 | Multiply the top by ten and add the digit |
+ - / * | Subtract, add, multiply or divide the top two |
> < | Move the top value to the next or the previous stack |
¥ £ | Move the pointer right or left |
% $ | Duplicate; swap the top two |
^ v | Bring the bottom value to the top; send the top to the bottom |
( ) | Skip past ) if the top is 0; go back to ( if it is not |
o O | Print the top as a number or as a character |
i I | Push a number or a character from the input |
The top is the left side of a sum. The brainfuck - is €1$+, which pushes 1, swaps it under the value and subtracts, so it only works that way round. With ^ and v one stack turns like a tape, which is how the specification runs brainfuck in PAO and shows it is Turing complete.
Example
Each letter is pushed as € and its code in digits and printed with O, which leaves it on the stack.
Each letter is pushed as € and its code in digits and printed with O, which leaves it on the stack.
A count down with the brainfuck - inside a loop. The o after the loop prints the 0 that ended it.
The stack pop cheat drops the 7 and leaves the 5.
Patterns it teaches
- Stack machines: a row of stacks, and no pop.
See also
Stack-based
Write your own in Run Convert a program from Pops Are Overrated
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pops-are-overrated.
Command line
shib run pops-are-overrated -e 'i(o)o' --input '0'shib manual pops-are-overratedSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pops-are-overrated.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org