'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
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
| Register | Holds |
|---|---|
| accumulator | an integer; arithmetic, tests and o use it |
| counter | an integer; digits are typed into it |
| source | a string; "text" sets it and p prints it |
| destination | a string; 'text' sets it |
| mutable and backup list | lists of strings |
| memory | integers stored under string names |
| Code | Does |
|---|---|
0–9 | counter = counter × 10 + digit |
a m x d r | accumulator plus, minus, times, divided by, modulo the counter |
c z | Swap accumulator and counter; set the counter to 0 |
o p i | Print the accumulator, the source, a newline |
g h n N G H | Run the next command only if the accumulator is > 0, < 0, 0, not 0, ≤ 0, ≥ 0 |
[ ] | Loop while the accumulator is not 0 |
{code} q | Store a function named by the destination; run the one named by the source |
O P I | Read 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…
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.
See also
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 33Source
- 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