This is a simple implementation of a Bf to LLVM IR compiler. It has no practical purpose beyond providing a sample project for playing with LLVM.
This compiler was built and tested with LLVM versions 4.0.1 and 6.0.0.
This project can be built with the included Makefile. The executable is called, bfc
.
Running Hello World:
cat examples/hello.bf | ./bfc > hello.ll
lli hello.ll
Running the IO Example (this will print "ABC"):
cat examples/io.bf | ./bfc > io.ll
echo "ABC" | lli io.ll
Alternatively, these examples can be compiled to binary files with llc
and clang
:
cat examples/hello.bf | ./bfc > hello.ll
llc hello.ll
clang -s hello.s
./a.out