This project is a compiler framework for the NearlyC
C subset front end. It contains the following components (in addition to the code provided
by nearly_c):
- A representation for C data types
- Symbol tables
- Linear intermediate representation for both "high-level" code (RISC-like, unlimited virtual registers) and low-level x86-64 code
- Control-flow graphs
- Generic dataflow analysis framework, with provided implementations for live values on both high-level and low-level IR
- Driver program with command line option handling
It omits implementation of the following components:
- Semantic analysis (type checking, building symbol tables and annotating AST nodes with pointers to symbol table entries, insertion of implicit conversions)
- Code generation
- Optimization
API documentation is available. (This is in progress, but should be complete soon.)
This project was developed for the 601.428 Compilers and Interpreters
course at Johns Hopkins University. The
Fall 2023 course web page
has the assignments in which students implement the missing parts.
(Note that the code in this repository has been refactored quite a bit,
so some minor details have changed.) The Fall 2023 course also has
a test repository
which is useful for testing code generation. (The assign04 and
assign05 subdirectories have the code generation tests.)
This repository is intended to be the official "public" release of NearlyCC. It is in a somewhat preliminary form currently, but is definitely at a point where it is useful. I will be adding documentation and making improvements in the future.
Please send comments to mailto:daveho@cs.jhu.edu.