Repository Information
| Language | Rust |
|---|---|
| Stars | 7 |
| Forks | 1 |
| Last Updated | 11/8/2025 |
Brainfuck compiler
This a simple implementation of a Brainfuck compiler in Rust, has several modes of operation, and can be used as a REPL.
You need to have Rust installed, which is usually done via curl to get rustup (further instructions in the Rust home page), or at least rustc rust compiler with the std lib.
Brainfuck Interpreter Example scripts
This project includes several examples in many different programming languages with the same approach to making a simple brainfuck interpreter, these are purely meant to see the difference on how the same program can look very different on some languages and to highlight the importance of writing idiomatic code.
Installation
If you want to install it, after cloning the repo, you can do so with:
cargo install --path .
Usage
Everything will be explained with Cargo, but you can also use the binary if you installed it.
Build
cargo run --release -- build <file>
If you want to save the intermediate code representation, you can add the
--save flag:
cargo run --release -- build <file> --save # or -s
Run
You can run the file directly like any other interpreted language would with:
cargo run --release -- run <file>
Or you can use the REPL mode with:
cargo run --release -- repl
And then you can enter your Brainfuck code, and it will be executed.
Help
If no command is given or if you use the --help flag it'll display the due
help message and if the same flag is used in any of the commands it'll show
relevant information too.
Example
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Output:
Hello World!
License
GNU General Public License v3.0
Sponsor
If you like this project, consider supporting me by buying me a coffee.