AlphaBeta
Every letter of the alphabet, lower and upper case, is an instruction. Nothing else is.
Voxel, 2009 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 5 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Voxel made AlphaBeta in early 2009 as an experiment in a language with many instructions that would still be easy to write. There are 52, one for each letter. There are no comments, because there is no character left over for them.
Read the story
The machine has two registers that programs change directly, a third that only holds results, a memory, and one more register that is either the memory pointer or the jump target. Z switches which of the two it moves. Try It Online runs a version corrected by Dennis Mitchell.
The machine
| Code | Does |
|---|---|
a–f | Add 1, −1, 10, −10, 100, −100 to register 1 |
g–l | The same for register 2 |
m n o p q | Register 3 = not r1, not r2, r1 and r2, r1 or r2, r1 xor r2 |
r s t u v w | Register 3 = r1 + − × ÷ mod power r2 |
x y z | Clear r1, r2, r3 |
A–F | Copy r1→r2, r2→r1, r1→r3, r2→r3, r3→r1, r3→r2 |
G H I | Load r1 or r2 from memory; store r3 |
J K | Read a character into r1 or r2 |
L M | Print r3 as a character or a number |
N O P Q | Jump if r1 =, ≠, ≥, ≤ r2 |
R | Jump if r3 is 0 |
S–X | Add 1, −1, 10, −10, 100, −100 to the pointer |
Y Z | Zero the pointer; switch between memory and position mode |
A jump goes to the position held by the position pointer, counted in characters from 0.
Example
In the second program aaa sets r1 to 3, Z switches the pointer to positions and YUTT sets it to 8, where…
In the second program aaa sets r1 to 3, Z switches the pointer to positions and YUTT sets it to 8, where the loop starts. The loop sets r2 to 48, prints r1 + 48, counts r1 down and clears r2 again, so that O jumps back while r1 is not 0. The third is the cat from esolangs.org; it stops after a carriage return, code 13, which yiggg puts in r2.
Patterns it teaches
- Counter machines: two registers with add and subtract, and a computed jump.
- Turing completeness: the corrected version with unbounded program size can run a Minsky machine.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from AlphaBeta
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: alphabeta.
Command line
shib run alphabeta -e 'JCLyigggO' --input 'ab
'shib manual alphabetaSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/alphabeta.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org