brainflop
Brainfuck with one command fewer, where input and output share a command and loops are jumps by a number kept in memory.
InfiniteDonuts, 2019 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
InfiniteDonuts made brainflop in 2019, after HighFive. It has 7 commands where brainfuck has 8 and works on 1024 cells. There are no brackets. Instead / jumps through the program by a distance that sits in the cell right of the pointer, so the code has to keep its own jump lengths in memory. Input and output are one command, *, which reads when the cell is 0 and prints when it is not.
Read the story
The specification says its author tried to write a truth machine and nearly lost his mind. The truth machine it lists does not work under the reading this implementation takes.
The machine
| Char | Does |
|---|---|
+ - | Add 1 to the cell, take 1 away |
< > | Move the pointer |
# | Set the cell to 0 |
* | Read a byte if the cell is 0, else print it |
/ | Skip the next character if the cell is 0, else jump by the cell to the right |
The specification calls / ambiguous, and its interpreter is gone. A jump of n lands n places on and then steps on as every command does. That is the reading under which the cat works. Every character takes up a place, so comments count in the distance.
Example
Hello World only adds and prints.
Hello World only adds and prints. # sets the cell back to 0 for the space.
The cat keeps -4 in the second cell. Each round sets the first cell to 0, reads into it, prints it, and jumps 4 back. At the end of the input the cell stays 0, / skips instead of jumping, and the program ends.
Patterns it teaches
- Turing tarpit: the specification shows it runs The Waterfall Model, given cells without a bound.
Further
See also
Cell-based
Write your own in Run Convert a program from brainflop
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: brainflop.
Command line
shib run brainflop -e '>----<#**/' --input 'Cat in a hat'shib manual brainflopSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/brainflop.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org