A minimalist Brainfuck interpreter and compiler written in C
- All 8 Brainfuck commands supported
- 30,000 memory cells
- File input/output
- Interactive input with
,command - Proper bracket matching for loops
- Compiles brainfuck code to FASM (x86_64 linux).
| Command | Description |
|---|---|
+ |
Increment memory cell |
- |
Decrement memory cell |
> |
Move pointer right |
< |
Move pointer left |
. |
Output character |
, |
Input character |
[ |
Jump forward if cell is 0 |
] |
Jump backward if cell is non-zero |
git clone https://git.sr.ht/~oled/brainsuck
cd brainsuck
gcc -Os brainsuck.c -o brainsuck./brainsuck <brainfuck_file> # INTERPRETER
# or
./brainsuck <brainfuck_file> -c # INTERPRETER + COMPILER
# out file name: compiled.brainsuck.asm++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>../brainsuck examples/hello.bf
./brainsuck examples/life.bf
./brainsuck examples/calculator.bfThis project is licensed under the GPL-3.0 License.
Created by oled.