The overall semester project is to build a compiler for the COOL programming
language, an imperative, object-oriented, type-safe language that is a model
of the Java language. You will be compiling COOL down to the LLVM virtual
instruction set, which is the Internal Representation for the LLVM compiler
infrastructure. You will also write some dataflow optimizations on the LLVM
IR. 1-unit students (see the Home page for a formal definition!) will also do
a "back-end" project, related to machine code generation. Your project will
be written in C++.
The programming guides and other documentation you will need for this project
are available on the Resources page.
To allow you to focus on the "interesting" issues, we will give you several
- Data structures for an Abstract Syntax Tree (AST) for COOL.
- A type checker for the COOL language because type checking is not a
topic of this class. It was covered in CS 421, a prerequisite, and you
should be familiar with the basic concepts of it.
- Data structures and some passes for the LLVM Internal Representation (IR).
- All the back end code generation facilities for LLVM.
Your (common) project will be divided into 4 parts:
- Scanner and Parser: Translate COOL programs into the COOL AST.
- Intermediate Code Generation 1: "Lower" the COOL AST to LLVM for non-object-oriented features.
- Intermediate Code Generation 2: Add object-oriented features such as
static/virtual method dispatch, type conversion, and some run-time checks.
- A fourth compiler task, TBA.
All deadlines are 5:00 p.m. Central Time unless noted otherwise.
: Released 8/30. Due Monday, 9/13, 5pm.
: Released 9/13. Due Monday, 10/4, 5pm.
: Released 9/20. Due Monday, 10/25, 5pm.
: Released 11/1. Due Monday, 11/29, 5pm.
: Released 11/12. Due Monday, 12/13, 5pm.