esolang

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

Expected: hi

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

CommandDoes
PSH nPush the number n
POPPop and print as a number
PPCPop and print as a character
INPRead a number and push it
ADD SUB MUL DIV MODPop two, push the result
NLNPrint a line feed
HLTHalt

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.

Expected: 42

Subtraction takes the top from the one below.

Expected: 5

Patterns it teaches

  • Stack machines: with no jumps, only a straight line of pushes and pops.

Further

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 whopper

Source

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