CS 142 (b): Compiler Construction Project

Winter 2013, Tue Thurs 8:00-9:20am, ICS 180

Instructor: Harry Xu, Office hour: by appointment, Credits: 4

TA: Gulfem Savrun Yeniceri (gsavruny@uci.edu), Office: CS 444


Test cases

Project FAQ

Useful resource (pointer tutorials, JVM specs, X86 instruction set, etc.)

Course Overview

This is a heavyweight project class that only programming geeks would love to take. The entire class is nothing but a project to build a Java compiler. The compiler takes .class files (bytecode) as input and generates X86 executable code. The course will give you hands-on experience with compiler construction and optimizations.


CS 142 (a) and C/C++ programming experience.

Course Organization

The course has five separate phases, and each phase is constituted by a lecture (given by me or the TA) that introduces the goal of the phase as well as a number of lab sessions.


Phase 1: Parsing .class files

Phase 2: Building a Java interpreter

Phase 3: Building SSA

Phase 4: Developing SSA-based optimizations (e.g., register allocation and other dataflow-based optimizations)

Phase 5: Generating X86 machine code


Each student needs to give a demo presentation on his/her project at the end of the quarter. I will provide a set of simple Java programs to test your compiler. You can get at least a B if your compiler can do phase 1, 2, and 3. If phase 4 and 5 are implemented and your compiler passes all my test cases, you will get an A. If your compiler does everything and has one additional dataflow optimization implemented, you will get an A+.


Thanks to Michael Franz, Shannon Alfaro, Mason Chang, and Eric Hennigan for providing advice and help with this course.