esolang

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

Expected: 0

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.

LettersDoes
a b c d e f g hMove right, down, left, up
i j k lAdd one, take one
m nRead a number into the cell
o pPrint the cell as a number
q rIf the cell is 0, jump to just after the next j
s tIf the cell is not 0, jump back to just after the previous i
u v w xMultiply by 10, divide by 10
y zPrint 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.
Expected: 20
Expected: 4142

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

Further

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-spaghetti

Source

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