upcrob / bf-llvm

Simple BF to LLVM IR compiler implementation for practice and reference.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bf-llvm

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.

Building

This project can be built with the included Makefile. The executable is called, bfc.

Usage

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

Compiling to a Binary

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

About

Simple BF to LLVM IR compiler implementation for practice and reference.


Languages

Language:C 99.0%Language:Makefile 1.0%