esolang

'33'

Thirty-three commands that are letters of the alphabet, working on seven fixed registers.

TheOnlyMrCat · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 5 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

TheOnlyMrCat made 33 with a plain aim; as many commands as possible should be letters, where most esolangs use punctuation. There are exactly 33 of them, a to z and seven capitals, plus a few symbols for literals and loops.

Read the story

There is no stack and no tape. A program has seven registers and moves values between them, two integers, two strings, two lists and a dictionary.

The machine

RegisterHolds
accumulatoran integer; arithmetic, tests and o use it
counteran integer; digits are typed into it
sourcea string; "text" sets it and p prints it
destinationa string; 'text' sets it
mutable and backup listlists of strings
memoryintegers stored under string names
CodeDoes
0–9counter = counter × 10 + digit
a m x d raccumulator plus, minus, times, divided by, modulo the counter
c zSwap accumulator and counter; set the counter to 0
o p iPrint the accumulator, the source, a newline
g h n N G HRun the next command only if the accumulator is > 0, < 0, 0, not 0, ≤ 0, ≥ 0
[ ]Loop while the accumulator is not 0
{code} qStore a function named by the destination; run the one named by the source
O P IRead a number, a character, a line
@Stop

The rest handle strings and lists. j and k read and write single characters, e appends, y b f w u v Z work on the lists, and l and s load and store memory.

Example

In 6c7xo the 6 goes into the counter, c swaps it into the accumulator, 7 goes into the empty counter and…
Expected: 42
Expected: 42
Expected: 3 bottles 2 bottles 1 bottles

In 6c7xo the 6 goes into the counter, c swaps it into the accumulator, 7 goes into the empty counter and x multiplies. The last program is the start of a 99 bottles program. The loop prints the accumulator and a line, then m takes the counter, 1, away until the accumulator is 0.

Patterns it teaches

  • Code golf: one letter per operation and implicit registers keep programs short.

Further

Also in Golfing

Write your own in Run Convert a program from '33'

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run 33 -e 'O3xo' --input '14'
shib manual 33

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/33.js

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

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