Brainfuck basic edition
Brainfuck basic edition
Brainfuck basic edition (also known as BBE) is an which removes some instructions while still being Turing-complete.
It removes + and - instructions; instead there is ~ instruction to toggle cell value (0 -> 1, 1 -> 0). The loop instructions are repeating as long as pointed memory cell is 0, not non-zero.
The standard for brainfuck basic edition is wrapping 1-bit cells, with 100,000 cells with wrapping memory borders.
Since there is only 1-bit cells, the . instruction will read 8 next memory cells (assumes 0 if some next cells goes on the border) and assumes the most significant bit of byte to print is 3 next cells; here is a table that specifies index of n next memory cells than current pointer position vs real bit index (0 is most significant bit):
| How many next cells | Bit index |
|---|---|
| 0 | 7 |
| 1 | 2 |
| 2 | 4 |
| 3 | 0 |
| 4 | 3 |
| 5 | 1 |
| 6 | 5 |
| 7 | 6 |
Input IO
The input handing is insanely difficult, but still possible. First the interpreter should split input into bit series. Then , command will shift input bit series, read one bit, set into current memory position. Standard definition defines EOF as no change to current cell.
Some algorithms & examples
Set memory to 1
[~]
Set memory to 0
[~]~
(Feel free to edit and add)
Computation Class
Brainfuck basic edition is Turing-complete if there is infinitely many cells since it can represent infinite data quantity and still has conditional loops which brainfuck has.