C Compiler written using ANTLR.
Not that this compiler only works on Linux and Mac, it will not run on windows (but it will work on WSL), learn more about wsl here.
Installation instructions can be found in the** Installation documentation**.
Once you have installed and compiled the project (compilation instructions are included in the installation documentation), you can start to compile c code:
cd compiler
./ifcc my_c_program.c
This will print out a source file in the console, if you desire totore the output, you can always run:
./ifcc my_c_program.c >> my_source_code.s
Now if you want to actually execute the code you must use an assembler. Note that only x86 assembly is supported as of now.
as my_source_code.s
That's it! If your code isn't too complex, it should compile just fine 😀
In order to run tests you need python 3.
To run tests, navigate to the tests
folder
cd tests
Run all tests by running the following command
./ifcc-test.py .
Since there are a lot of tests and waiting isn't very cool we there is a multithreading flag which will run the tests in parrallel. Note that the tests make take a bit longer to get started (but they will over run a lot faster), and that it might not work on every machine.
To enable multithreading use the -m
flag
./ifcc-test.py . -m
If you want to run a specific set of tests you can modify the .
for the relative path of the file/ folder you want to run. Here is an example for running the tests in the core
folder only:
./ifcc-test.py ./testfiles/core
Want to contribute to the project? Checkout our developer documentation to make sure you understand how it works.