A C to P-code compiler project by Christophe Verdonck and Stein de Groof
A makefile is provided for building and testing the project. In absence of the make utility the equivalent commands are given below:
Generates the parser classes using antlr
java -jar c2p/src/parser/antlr-4.6-complete.jar -Dlanguage=Python3 c2p/src/parser/C.g4 -visitor
runs the automatic test script verifying mostly semantic checks
python3 runtests.py -v
run both above commands
removes generated files
The c2p.py script will take a C-file and compile it into a P-file on the condition the parser classes have been built using the above command.
syntax: python3 c2p.py cfile.c pfile.p
Test files are located in c2p/tests/testfiles organised in subdirectories by feature and given descriptive names. All the tests are run automatically by the test script, except for the one under 'codegen', as the results of those can not easily be verified automatically.
The source for the compiler can be found under c2p/src.