ABG
Brainfuck in four letters, where every loop has to step left before it can start.
ChuckEsoteric08 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
ChuckEsoteric08 made ABG with four commands. Two of them fuse a pair of brainfuck commands, so a adds 1 and moves right, and g moves left and then opens a loop. Nothing moves left alone and nothing adds without moving. The plain brainfuck commands come back as short words, so + is agc and > is ba.
Read the story
That needs one exception. gc with nothing between them is only a move left, and a loop that does nothing has to be written g c, with a space.
ABGAD is the same language with input, output and halt, and the examples use it.
The machine
| Command | Brainfuck | Does |
|---|---|---|
a | +> | Add 1, move right |
b | - | Take 1 off |
g | <[ | Move left, skip past the matching c if the cell is 0 |
c | ] | Jump back to the matching g if the cell is not 0 |
gc | < | Move left |
d | , | Read a byte (ABGAD) |
# | . | Print the cell as a character (ABGAD) |
e | Halt (ABGAD) |
Cells are bytes, as in brainfuck. The specification never says what lies left of the first cell. This implementation keeps the pointer where it is, which is what makes the infinite loop agcg c loop.
Example
The truth machine.
The truth machine. It prints the digit it reads, then takes 49 off and adds 1, so 0 gives a 0 cell and the g at the end of the first line skips the whole loop. A 1 would print 1 forever.
The specification's table turns brainfuck into ABG, and ABGAD's # stands in for .. The program ++++++++[>++++++++<-]>+. multiplies 8 by 8, adds 1 and prints A.
Patterns it teaches
- Turing tarpit: four letters, and the proof is a table from brainfuck.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from ABG
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: abg.
Command line
shib run abg -e 'gc'shib manual abgSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/abg.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org