esolang

Minimized BF

Brainfuck with four commands left. Input and output happen around the run, never during it.

None1, 2023 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: cat

The idea

None1 made Minimized BF in 2023 as brainfuck with only +, >, [ and ]. The tape is a circle of 256 cells of 8 bits, so 255 + take 1 away and 255 > step back one cell. That is why - and < could go.

Read the story

There are no commands for input and output either. The input is written into the tape before the run, and whatever the tape holds after the run is the output. With 256 cells the machine has a fixed number of states, so the specification calls it almost Turing complete.

The machine

CommandDoes
+Add 1 to the cell, 255 wraps to 0
>Move to the next cell, the last wraps to the first
[ ]Loop while the cell is not 0

Before the run the first line of input goes into the cells from the first one on, a byte per cell. After the run the cells are printed from the first one up to the first cell that holds 0. The interpreter in the specification is followed, and its list has one cell more than the pointer reaches, so only input can fill cell 257.

Example

The cat program on the specification is empty.

The cat program on the specification is empty. The input goes into the tape and comes out again.

Every character of the input gets 1 more, until the loop meets the 0 after the last one.

Expected: IBM

The Hello World counts each character up in its own cell, 72 + for the H, then >, and so on for 12 cells. Two cells done the same way, 72 and 105, spell Hi.

Expected: Hi

Patterns it teaches

  • Turing tarpit, four commands, and only the 256 cells keep it from the full power of brainfuck.

Further

Minimized BF builds on Brainfuck.

Non-interactive IO

Brainfuck derivatives

Write your own in Run Convert a program from Minimized BF

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: minimized-bf.

Command line

shib run minimized-bf program.txt

The program is long; save it as program.txt first.

shib manual minimized-bf

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/minimized-bf.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org