esolang

StupidStackLanguage

Twenty-six letters, one stack of numbers, and loops made of t and u.

Lebster, 2020 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 9 known programs · Test method

Run it

Expected: hello world

The idea

Lebster made StupidStackLanguage in 2020. Every letter of the alphabet is one command and nothing else counts, so a program looks like a string of random letters. Most commands do not pop. g adds the top two and pushes the sum on top of them, so programs keep cleaning up with b.

Read the story

This implementation follows the Python interpreter printed in the specification, quirks included.

The machine

LetterDoes
a b q yPush 0, pop, duplicate, empty the stack
i d v wAdd 1, -1, 5 or -5 to the top
g c m p ePush top plus, minus, times, divided by, mod the second
nPush 1 if the top two are equal, else 0
l r o sSwap the top two, push the length, remove or swap by index
f xPrint the top as a character or a number
j hRead a line, push its first character or its number
kSkip the next letter if the top is 0
t uLoop: skip to u if the top is 0, go back to t if it is not
zStop

Numbers have no size limit, and p gives a float such as 3.5. On a top that is not 0, k falls through to the interpreter's invalid-character branch, which prints a message and stops.

Example

Hello World builds each letter from the one before it.

Hello World builds each letter from the one before it.

The factorial from the specification. q d keeps x and a counter below it, and the loop multiplies and counts down.

Expected: 120

The calculator reads X, Y and Z and counts Z down to pick an operation. Z of 3 divides.

Expected: 3.5

The Ackermann function, with A(2, 3) = 9.

Expected: 9

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from StupidStackLanguage

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: stupidstacklanguage.

Command line

shib run stupidstacklanguage -e 'jf' --input 'cat
'
shib manual stupidstacklanguage

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/stupidstacklanguage.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org