esolang

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

Expected: Hello, World!

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

CodeDoes
a–fAdd 1, −1, 10, −10, 100, −100 to register 1
g–lThe same for register 2
m n o p qRegister 3 = not r1, not r2, r1 and r2, r1 or r2, r1 xor r2
r s t u v wRegister 3 = r1 + − × ÷ mod power r2
x y zClear r1, r2, r3
A–FCopy r1→r2, r2→r1, r1→r3, r2→r3, r3→r1, r3→r2
G H ILoad r1 or r2 from memory; store r3
J KRead a character into r1 or r2
L MPrint r3 as a character or a number
N O P QJump if r1 =, ≠, ≥, ≤ r2
RJump if r3 is 0
S–XAdd 1, −1, 10, −10, 100, −100 to the pointer
Y ZZero 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…
Expected: 321
Expected: ab

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

Further

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 alphabeta

Source

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