Alphabetti spaghetti
Every letter of the alphabet is a command, two letters to each, and the program can only print numbers.
2015 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 6 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
An anonymous user made Alphabetti spaghetti in 2015. A program is a string of letters. The 26 letters come in 13 pairs, and both letters of a pair do the same thing, in either case. Anything that is not a letter is ignored, so any text is a program.
Read the story
It works like a two dimensional Brainfuck with numbers instead of bytes. Output is always a number, except for y and z, which print the program's own source.
The machine
A pointer starts at (0, 0) on an endless grid of integer cells, all 0. This implementation follows stasoid's C interpreter, the one TIO runs, so the cells are 32-bit and numbers are printed with nothing between them.
| Letters | Does |
|---|---|
a b c d e f g h | Move right, down, left, up |
i j k l | Add one, take one |
m n | Read a number into the cell |
o p | Print the cell as a number |
q r | If the cell is 0, jump to just after the next j |
s t | If the cell is not 0, jump back to just after the previous i |
u v w x | Multiply by 10, divide by 10 |
y z | Print the source |
The jumps look for the letters j and i themselves, not their partners. A q with no j after it ends the program; a t with no i before it goes back to the start.
Example
The first is TIO's Hello World: it prints the empty cell.
The first is TIO's Hello World: it prints the empty cell. The second sets 3, and the i that marks the loop makes it 4; each pass takes two off and prints, so it prints 2 and then 0. The third reads 41, prints it, adds one and prints again.
Patterns it teaches
- Turing tarpit: unbounded cells, moves and two jumps.
- Every text runs: only letters count, so every sentence is a program.
See also
Also in Turing tarpits
Write your own in Run Convert a program from Alphabetti spaghetti
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: alphabetti-spaghetti.
Command line
shib run alphabetti-spaghetti -e 'o'shib manual alphabetti-spaghettiSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/alphabetti-spaghetti.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org