brainfuck-ng
Brainfuck that reads and prints numbers, and can stop when it likes.
Fernando Iazeolla, 2015 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Fernando Iazeolla wrote bfng in 2015, an interpreter for a superset of brainfuck. It adds three commands. ! prints the current cell as a decimal number, ? reads one, and @ ends the program. Every brainfuck program runs on it unchanged, unless its comments hold one of those three.
Read the story
The bfng program does more around the language. It returns the last cell used as its exit status, it can start from a tape given as data and print the tape afterwards, and with -r it runs ReverseFuck, where every command means its opposite. Those are options of the program, not commands, and this implementation runs the default mode only.
The machine
| Command | Does |
|---|---|
+ - < > . , [ ] | As in brainfuck |
! | Print the cell as a decimal number |
? | Read a decimal number into the cell |
@ | End the program |
The tape is bfng's default environment array of 32,768 byte cells that wrap at 256. Every other character is a comment.
Example
The first is the run the specification shows.
The first is the run the specification shows. bfng reads 35, adds 3 and prints 38. The second is brainfuck's usual Hello World, unchanged.
Patterns it teaches
- Turing tarpit: brainfuck's eight commands, with decimal input and output so numbers need no conversion loops.
Further
See also
brainfuck-ng builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from brainfuck-ng
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: brainfuck-ng.
Command line
shib run brainfuck-ng -e '?+++!' --input '35'shib manual brainfuck-ngSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/brainfuck-ng.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org