hypothalamus 0.2.0

An optimizing Brainfuck AOT compiler with an LLVM IR backend
Documentation
use hypothalamus::DEFAULT_TAPE_SIZE;
use hypothalamus::bf;
use hypothalamus::llvm::{self, LlvmOptions};

fn compile_example(source: &[u8], name: &str) -> String {
    let ops = bf::parse(source).expect("example should parse");
    llvm::generate_module(
        &ops,
        &LlvmOptions {
            tape_size: DEFAULT_TAPE_SIZE,
            target_triple: None,
            source_filename: Some(name.to_string()),
            bounds_check: false,
        },
    )
    .expect("example should lower to LLVM IR")
}

#[test]
fn hello_example_lowers_to_llvm() {
    let ir = compile_example(include_bytes!("../examples/hello.b"), "examples/hello.b");
    assert!(ir.contains("define i32 @main()"));
}

#[test]
fn dbfi_self_interpreter_lowers_to_llvm() {
    let ir = compile_example(include_bytes!("../examples/dbfi.b"), "examples/dbfi.b");
    assert!(ir.contains("define i32 @main()"));
    assert!(ir.contains("loop_check_"));
}