Yet Another Brainfuck Interpreter in Rust
Rust
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
programs
src
.gitattributes
.gitignore
.travis.yml
Cargo.lock
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md

README.md

Yet Another Brainfuck Interpreter in Rust

Build Status

Lately I have been learning Rust. As my first project, I decided to write a Brainfuck interpreter. Feel free to submit issues or pull requests on how may I improve the code!

Building and Running

  • Ensure that you have a Rust installed, including cargo (Rust's build and package manager).
  • Clone the repository:
$ git clone https://github.com/s3rvac/yabir
  • Build the interpreter:
$ cargo build --release
  • Run it on a Brainfuck program:
$ target/release/yabir PROG

The programs directory contains a few sample programs you can try.

Implementation Notes

As stated here, there are some portability issues that developers of Brainfuck interpreters and programs need to be aware of. My implementation behaves as follows:

  • Cells are 8-bit unsigned integers. They wrap around (e.g. when incrementing 255, you get 0).
  • The data array has potentially unlimited size and is automatically resized. However, the array can be extended only to the right.
  • Emitted ends of lines are platform-specific (e.g. LF on Linux).
  • The behavior of the , command (read a byte from the input stream) when an end-of-file condition has been encountered is to leave the current cell unchanged.

License

Licensed under either of

at your option.