A mini š§ ācompiler using C++ and LLVM
- Learn about LLVM and code generation (IR)
- Learn basic compiler optimizations (what the LLVM functions are doing under the hood)
- Get better at C++
Use generate the mini-brain
executable
clang++ -g main.cc `llvm-config --cxxflags --ldflags --system-libs --libs core orcjit native` -O3 -o mini-brain
Running this program should generate the LLVM IR of your BF code in program.bf
To compile the IR to a binary, use
./mini-brain | clang -x ir -
Lastly, run ./a.out
to see your program's result!