Whopper
Eleven three-letter commands on a stack, one per line, and no way to jump.
hyperdawg · Turing complete: no · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
hyperdawg wrote Whopper in Python in under 100 lines. A program reads like assembly. Each line is a three-letter command, and the commands work a stack of whole numbers. There are no labels and no jumps, so a program runs from the top line to the bottom once and always ends.
Read the story
The only constants come from PSH. The specification's own example still builds its letters by arithmetic, an h as 10 times 10 plus 4.
The machine
| Command | Does |
|---|---|
PSH n | Push the number n |
POP | Pop and print as a number |
PPC | Pop and print as a character |
INP | Read a number and push it |
ADD SUB MUL DIV MOD | Pop two, push the result |
NLN | Print a line feed |
HLT | Halt |
A line that starts with : and a space is a comment. The specification does not say which way round SUB, DIV and MOD go. They work the one below on the top, so PSH 7, PSH 2, SUB leaves 5, and DIV rounds down.
Example
The hi, without its comments.
The hi, without its comments. 104 is h and 105 is i.
The cat reads a number and prints it.
Subtraction takes the top from the one below.
Patterns it teaches
- Stack machines: with no jumps, only a straight line of pushes and pops.
Further
See also
Stack-based
Write your own in Run Convert a program from Whopper
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: whopper.
Command line
shib run whopper -e ': cat
INP
POP' --input '42'shib manual whopperSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/whopper.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org