brainpreter

Crates.iobrainpreter
lib.rsbrainpreter
version0.1.0
sourcesrc
created_at2017-11-10 23:00:33.45946
updated_at2017-11-10 23:00:33.45946
descriptionA simple and easy to use brainfuck interpreter.
homepage
repositoryhttps://github.com/DimChtz/brainfuck/tree/master/rust-brainpreter
max_upload_size
id38924
size19,590
(DimChtz)

documentation

README

rust-brainpreter (brainpreter) - v0.1.0

A simple and easy to use Brainfuck interpreter.

How to use (Hello world! Example)

Create a new brainpreter.

let mut bf = brainpreter::Inter::new();

Load brainfuck code from text string or file.

// For file use: .load_from_file()
match bf.load("++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.") {

    Ok(_) => {}
	
    Err(e) => println!("{}", e),
	
}

Compile the bf code.

match bf.parse() {
        
    Ok(_) => {}
	
    Err(e) => println!("{}", e),

}

Finally run it.

match bf.run() {
        
    Ok(_) => {}
	
    Err(e) => println!("{}", e),

}

Result on the console.

Hello world!

Installation

Add this line to your Cargo.toml:

[dependencies]
brainpreter = "0.1.0"

and then add this line to your main.rs:

extern crate brainpreter;
Commit count: 0

cargo fmt