S.B.M.F.B
Brainfuck programs kept on a stack, and run from the top or from the bottom.
Yayimhere, 2024 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Yayimhere made S.B.M.F.B in 2024. The name stands for stack based memory for brainfuck. A program does not run brainfuck directly. It pushes pieces of brainfuck onto a stack, moves them about and runs them, the top one or the bottom one, as often as it likes.
Read the story
Every piece works on the same tape. So one piece can read a character and a later piece can print it, which is how the cat works.
The machine
| Command | Does |
|---|---|
€(code) | Push the brainfuck code onto the stack |
run run^ | Run the top program |
runV | Run the bottom program |
shift^ | Move the top program one down |
shiftV | Move the bottom program one up |
A program stays on the stack after it runs. Cells hold 0 to 255 and wrap, the tape is unbounded both ways, and , reads 0 at the end of the input.
Example
The cat's first program reads one character.
The cat's first program reads one character. The shift does nothing on a stack of one. The second program prints the cell and reads the next one, until the end of the input leaves a 0.
The third sets a cell to 65 with the top program and then runs the bottom one three times. Each run prints the cell and adds 1 to it.
Patterns it teaches
- Turing tarpit: brainfuck, cut into pieces that share one tape.
- Stack machines: the stack holds programs, not numbers.
Further
See also
S.B.M.F.B builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from S.B.M.F.B
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: s-b-m-f-b.
Command line
shib run s-b-m-f-b -e '€(,)
run
shift^
€([.,])
run' --input 'cat'shib manual s-b-m-f-bSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/s-b-m-f-b.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org