This is just me practicing compiler engineering after a long time of not doing so :)
First clone the repository
git clone https://github.com/OmarAzizi/expression-compiler.git && cd expression-compilerThen make the build directory and change into it
mkdir build && cd buildRun the build command
cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_DIR=/usr/lib/llvm ../ && ninjaThen go into the src directory inside of build where you will find the calc executable and run the following command:
./calc "with a: a*3" | llc -filetype=obj -relocation-model=pic -o=expr.oNote: The expression could be changed to anything you want, with any amount of variables
Then link expr.o with the runtime library rtcalc.c as follows:
clang -o expr expr.o ../../rtcalc.c
After running the expr executable you will be asked to input a value for a
