AssemblerFuck
Brainfuck dressed up as assembler. Five words do the work of eight characters.
Sesshomariu, 2016 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Sesshomariu made AssemblerFuck in 2016. Every brainfuck command becomes a word that looks like assembler. + and - become ADD and SUB with a count, so ADD 8 is eight plusses. The pointer, the input and the output are all reached with one MOV, and the loop is UNTIL 0 ... END.
The machine
| Word | brainfuck | Does |
|---|---|---|
ADD n | + n times | Add n to the cell |
SUB n | - n times | Take n from the cell |
MOV RIGHT, P | > | Move the pointer right |
MOV LEFT, P | < | Move the pointer left |
MOV OUT, P | . | Print the cell |
MOV P, IN | , | Read a byte into the cell |
UNTIL 0 ... END | [ ... ] | Loop while the cell is not 0 |
Cells are bytes that wrap. At the end of the input MOV P, IN puts 0. The specification's line for END says it jumps back when the cell is 0, but the examples only work the brainfuck way round, so that is how it runs.
Example
The cat reads a byte, then prints it and reads the next until the input runs out.
The cat reads a byte, then prints it and reads the next until the input runs out. Its Hello World is the well known brainfuck one, word for word, and prints Hello World!.
The truth machine prints its input, then takes 2 from it each round. On 0 the cell reaches 0 after 24 rounds and the loop ends.
On 1 the cell is odd and never reaches 0, so the machine needs the wrap. The next cell counts the rounds, and after 256 rounds it wraps to 0. Then the pointer stays on it, the step left lands on the input cell, which is back at 49, and the inner loop prints 1 forever.
Patterns it teaches
- Turing tarpit: brainfuck under other names.
Further
See also
AssemblerFuck builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from AssemblerFuck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: assemblerfuck.
Command line
shib run assemblerfuck -e 'MOV P, IN
UNTIL 0
MOV OUT, P
MOV P, IN
END' --input 'Hello, cat!'shib manual assemblerfuckSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/assemblerfuck.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org