Skip to main content

Crate breakfast

Crate breakfast 

Source
Expand description

§The Breakfast Brainfuck Interpreter

Breakfast is a minimal brainfuck (BF for short) interpreter in Rust.

It offers most of the suggested BF features, including multiple EOF behaviors and # for debug purposes.

§Example

Here is a simple piece of code to run the “Hello World” BF program:

use breakfast::*;

fn main() -> std::io::Result<()> {
    let program = Breakfast::parse(
        r#"
            >++++++++[<+++++++++>-]<.
            >++++[<+++++++>-]<+.
            +++++++..
            +++.
            >>++++++[<+++++++>-]<++.
            ------------.
            >++++++[<+++++++++>-]<+.
            <.
            +++.
            ------.
            --------.
            >>>++++[<++++++++>-]<+.
        "#
    );

    let mut bf = Breakfast::new(Default::default());
    bf.run(program)?;

    Ok(())
}

Structs§

Breakfast
The interpreter struct.
Config
The configuration of the Breakfast interpreter.

Enums§

EofBehavior
An EofBehavior indicates the behavior to handle empty inputs.