We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Immutable Brainfuck
Immutable Brainfuck is an esoteric programming language and a brainfuck derivative created by User:Rainwave in 2026. It was created to demonstrate the idea of monotonic computation, something that Rainwave has had in mind ever since he created Leafuck, as well as to create a language that satisfies both monotonicity and reversibility at once.
Language Semantics
Like brainfuck, the language operates on a right-unbounded tape, where the initial cells are all 0. Unlike brainfuck however, the commands cannot modify existing cells. Instead, new cells are dynamically inserted in the middle of the tape. A pointer is initially set to point to the first cell.
Immutable Brainfuck has the following commands
| Command | Description |
|---|---|
> |
Move the pointer right by one cell. |
< |
Move the pointer left by one cell. If the pointer is currently at the first cell, the result is an undefined behavior. |
[ |
If the current cell is 1, jump to the instruction after the matching ]. Note that this is slightly different from brainfuck where a loop is skipped if the current cell is 0.
|
] |
If the current cell is 1, jump to instruction after the matching [.
|
1 |
Insert a new 1 cell right after the current cell. |
0 |
Insert a new 0 cell right after the current cell. |
. |
Read eight contiguous cells starting from the current cell, interpret them as a byte, and output them as a single ASCII character. Note that the pointer's position remains unchanged. |
, |
Read an ASCII character from the input stream. Then, insert eight new cells right after the current cell, containing the character's binary representation. |
All characters other than the symbols listed above are ignored. If the brackets ([ and ]) are not balanced, the program contains a syntax error.
Examples
Hello World!
0>1>0>0>1>0>0>0<<<<<<. 0>1>1>0>0>1>0>1<<<<<<. 0>1>1>0>1>1>0>0<<<<<<. 0>1>1>0>1>1>0>0<<<<<<. 0>1>1>0>1>1>1>1<<<<<<. 0>0>1>0>0>0>0>0<<<<<<. 0>1>0>1>0>1>1>1<<<<<<. 0>1>1>0>1>1>1>1<<<<<<. 0>1>1>1>0>0>1>0<<<<<<. 0>1>1>0>1>1>0>0<<<<<<. 0>1>1>0>0>1>0>0<<<<<<.
Truth Machine
,>>>>>>>>[1]>[0>0>1>1>0>0>0>1<<<<<<.1>]0>0>1>1>0>0>0>0<<<<<<.
Reversibility
Immutable Brainfuck is reversible in the sense that at any state of the execution, it is possible to uniquely determine the previous state or to determine if the previous state was invalid. This is because each command has an inverse that can undo its effect when running the machine backwards.
| Command | Inverse |
|---|---|
> |
Move the pointer left by one cell. If the pointer is currently at the first cell, the machine has evolved from an invalid state. |
< |
Move the pointer right by one cell. |
[ |
If the current cell is 1, jump to the instruction before the matching ].
|
] |
If the current cell is 1, jump to the instruction before the matching [.
|
1 |
Delete the next cell if its value is 1. Otherwise, the machine has evolved from an invalid state. |
0 |
Delete the next cell if its value is 0. Otherwise, the machine has evolved from an invalid state. |
, |
Delete eight contiguous cells after the current cell. |
Computational class
Immutable Brainfuck is Turing complete as Bitwise Cyclic Tag can be compiled into it, though Rainwave is currently in the process of writing the proof.