BFVM

Compiler for the BF Programming Language

Getting Started

To install:

opam install .

in the root of this repository.

Compiler Binary

The entry point for the compiler is called bfc. Run bfc --help for a list of options.

API Documentation

Examples

Here are some common use cases:

Parse String of BF Code

let str = ">>>++---" in
let tokens = Parser.parse str in
...

Generate LLVM IR Module and Optimize It

let the_module = Codegen.generate tokens in
let _ = Passes.fold_loops the_module in
Llvm.dump_module the_module

Turn BF Input File Into Executable

Compiler.compile "in.bf" "a.out" Exe O1