asdf
Four keys of the home row, a tape of bits, and input and output hidden in the first two cells.
David.werecat, 2012 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
David.werecat made asdf in 2012. There are four instructions, and none of them is input or output. Instead, toggling cell 0 twice in a row reads a bit into cell 2, and toggling cell 1 twice in a row writes the bit in cell 2. The pointer starts at cell 3, out of the way.
Read the story
There is also no plain left or right. s moves left if the last instruction toggled a bit and right if not, so the same letter goes both ways. The plain moves are built from it. aas always moves left, and aasss always moves right.
The machine
| Instruction | Does |
|---|---|
a | Toggle the current bit and set the toggle flag |
s | Move left if the flag is set, else right; clear the flag |
d | If the bit is 1, jump forward to the matching f; clear the flag |
f | If the bit is 0, jump back to the matching d; clear the flag |
Bits gather into bytes, the high bit first. The specification leaves the bit order open; the high bit first is the order its Hello World needs. Reading past the end of input ends the program.
Example
A cat.
A cat. Each pass toggles cell 0 twice to read a bit into cell 2, then toggles cell 1 twice to write that bit out.
Hello World from the specification sets cell 2 to each bit in turn and writes it, 104 bits in all.
Patterns it teaches
- Turing tarpit: brainfuck on bits, with even the moves folded into one letter.
- Encoding tricks: input and output are cells, reached by toggling twice.
Further
See also
asdf builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from asdf
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: asdf.
Command line
shib run asdf -e 'daasaasasaasssaasssasssf' --input 'Hi'shib manual asdfSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/asdf.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org