#lexer #brainfuck #compiler #bf

bfmod

Brainfuck lexer and compiler library for Rust

1 unstable release

0.1.0 Oct 1, 2021

#990 in Programming languages

MIT license

12KB
178 lines

bfmod

Brainfuck lexer and compiler library for Rust.

Example Usage

use bfmod;

fn main() {
    println!("Starting to lexerize...");
    let tokens = bfmod::lexer::execute(">++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-]<+.");
    println!("Lexerizing is finished.");
    println!("Checking syntax errors.");

    match bfmod::lexer::check_brackets(&tokens) {
        Ok(()) => {
            println!("Building the source code.");
            bfmod::compiler::build(&tokens, "compiled.rs");
        },
        Err(msg) => {
            println!("Error ({})", msg)
        }
    }
}

Found a Bug / Error?

If you found a bug or an error, please create a new issue at gitlab repository.

Contributing

If you want to contribute this project:

  • Make sure you add the comments for your codes.
  • Please do not something useless.

Authors

License

This project is distributed under MIT license.

Project status

Under development.

No runtime deps