- Install LLVM
brew install llvm
- Download or clone project
git clone git@github.com:ildar-gilfanov/BraceCompiler.git
- Change folder
cd BraceCompiler
- Run building
swift build -Xcc -I$(llvm-config --includedir) -Xlinker -L$(llvm-config --libdir) $(llvm-config --libs | sed s/-l/"-Xlinker -l"/g) $(llvm-config --system-libs | sed s/-l/"-Xlinker -l"/g) -Xlinker -lc++ -Xswiftc "-target" -Xswiftc "x86_64-apple-macosx10.14"
Pass input and output file to BraceCompiler:
.build/debug/BraceCompiler Example/input.b Example/output.ll
- Generate project
swift package generate-xcodeproj
- Open
open BraceCompiler.xcodeproj
- Add output of
llvm-config --libdir
to Library Search Path - Add output of
llvm-config --includedir
to Header Search Path - Add libLLVM.dylib, located in
llvm-config --libdir
, to Linked Frameworks and Libraries - Run building
cmd+b
- Find binary file in Products folder and run compilation
BraceCompiler input.b output.ll
Pass your .ll file to lli command:
lli output.ll