Skip to content

Clesiaaa/BF-Interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 BF Interpreter (Rust)

A BF interpreter written in Rust, simple, fast, and usable as a system command.


✨ Features

  • Full Brainfuck language support (><+-.,[])
  • Automatically ignores spaces, tabs, newlines, and comments
  • Executable via the brainfuck command
  • Clean architecture: tokenizer β†’ parser β†’ virtual machine

πŸ“¦ Requirements

Check with:

rustc --version
cargo --version

πŸš€ Installation

Local installation

git clone https://github.com/Clesiaaa/BF-Interpreter
cd BF-Interpreter
cargo build --release

Then copy the compiled binary to your Cargo bin directory:

cp target/release/bf ~/.cargo/bin/

Make sure ~/.cargo/bin is in your $PATH.


Option 2 β€” Quick test without installation

cargo run program.bf

▢️ Usage

bf program.bf

Example

echo ">++++[<++++++++>-]<+." > hello.bf
bf hello.bf

πŸ—‚ Project structure

src/
β”œβ”€β”€ main.rs              # Entry point, CLI handling
β”œβ”€β”€ tokenizer.rs         # Brainfuck filtering and tokenization
β”œβ”€β”€ parser.rs            # Program construction
└── virtual_machine.rs   # Program execution

πŸ›  Manual compilation

cargo build --release

Generated binary:

target/release/bf

Run directly:

./target/release/bf program.bf

πŸ“š About BF

Brainfuck is a minimalist esoteric programming language made of only 8 instructions:

Instruction Description
> Move the pointer to the right
< Move the pointer to the left
+ Increment the current cell
- Decrement the current cell
. Output the current cell as a character
, Read one character of input
[ Start loop
] End loop

All other characters are ignored.


🧩 Possible improvements

  • Debug mode (--debug)
  • Step-by-step execution
  • Configurable memory size
  • Input file support

πŸ“„ License

Free project β€” do whatever you want πŸ˜„


πŸ‘€ Author

Developed by ROBERT FOLGA

About

🧠⚑️A BrainF interpreter written in Rust, simple, fast, and usable as a system command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors