brain-rs 0.1.0

Embeddable brainfuck interpreter
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extern crate brain;

use brain::{Compiler, ByteCode};

#[test]
fn test_with_bytecode() {
    let code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
    let mut comp = Compiler::new(code);
    let instruction = comp.compile();
    let by = ByteCode::generate_bytecode(instruction);
    let mut byte_code = ByteCode::new(&by);
    println!("{:?}", byte_code);
    byte_code.execute();
}