To compile the compiler you need the following packages:
-
g++
Check if it is installed with
g++ version
and if not installed, install with
xcode-select --install
This should install g++ to
/usr/bin/g++
which is where cmake expects it to be. Make sure this is the case.This will install tons of useful packages, including
g++
. -
make
Check if it is installed with
make --version
and otherwise install with
xcode-select --install
This will install tons of useful packages, including
make
. -
cmake
Check if it is installed with
cmake --version
and otherwise install with
brew install cmake
(In case
brew
is not installed on your computer you can install it following the instructions here)
To compile first create a directory named build
in the root and then run
cd build && cmake .. && make
This will create an executable named inslt
.
After compiling make sure you are in the build
directory. Use ./inslt
to run the executable. It takes up to two arguments, the first one being the input file and the second one being an optional output name for the compiled program (defaults to a.out
). For example you can run
./inslt ../tests/fibonacci.inslt my_output_file
to compile the file fibonacci.inslt
located in the tests
directory and name the resulting file my_output_file
. That file can now be run with ./my_output_file
.