This is a pre-processed C90 to MIPS assembly compiler, produced as part of the EIE 2nd Year Compilers coursework.
This compiler uses Flex to lex (ANSI C lex specification) and Yacc to parse (ANSI C Yacc grammar) the input C language, and generates the corresponding MIPS assembly code using C++.
This project passed all 247 tests in the compiler_tests
folder (including seen tests and extra tests), and it passed 184 out of 202 examiner tests (including seen tests and unseen tests)
Use ./utility/test_dir.sh
to run all testcases.
Use ./utility/test_dir.sh DIR_NAME
to run all test cases under the specified directory.
Use ./utility/test.sh
to run the a single test case ./utility/my_test.c
with ./utility/my_test_driver.c
. You can check the assembly output in my_test.s
This folder contains the test cases grouped by types. It includes all given test cases as well as some extra test cases to further test the compiler's functionalities.
This folder contains all header files, which includes the declarations of the assembly code generation functions.
This folder contains the project specification.
It contains the lexer written in Flex and the parser written in Yacc. It also includes the cpp files which generate the assembly codes.
It contains the bash files to build and test the compiler code.