A demo about how to build a real compiler with LLVM libraries, write for the book https://github.com/tuoxie007/play_with_llvm .
$ git clone https://github.com/tuoxie007/play_with_llvm_write_a_real_compiler
$ cd play_with_llvm_write_a_real_compiler
$ cd play
$ ./build.sh
$ ./play
Then a .o
file will be wrote in tests/
.
- Open the startup file
play/cli.cpp
. - Change the macro
TEST
. - Rebuild and run.
#define TEST "int_indexer"
//#define TEST "int_pointer_arg"
//#define TEST "delete_ptr"
- Write a test file in directory
play/tests
. - Save it with extension
.play
. - Change the macro
TEST
inplay/cli.cpp
. - Rebuild and run.
Have fun!