COMP3002: Compiler Construction
Always looking to improve, our TA, Sander, asked me
to post a link to the newly-created TA feedback form
so that you can offer any constructive criticism you might have.
Assignment 4 is now available (see below).
Here are the Assignment 1, 2, and 3 marks
To compute your
secret ID, enter your student number in the form below:
(Note: Sander has some updated marks for Assignments 1 and 2. The updates are not in this spreadsheet yet.) (Note 2: Assignment 3 was marked out of 45. The last question was treated as a bonus question.)
The TAs' office hours will be posted here as soon as we get some TAs.
If you need to see me outside of my office hours you can always try dropping by my office. Send me an email in advance if you really need me to be there.
The TAs/office hours for this course are:
|Pat Morin||Tue 9:00-10:00||5177 HP
|Pat Morin||Tue 13:30-14:30||5177 HP
|Sander Verdonschott||Fri 13:00-14:00||1175 HP
The CCSS COMP3002 Forum
is now up. Please post any questions you have about the assignment or course material there.
This course is about how to build a compiler. The main areas covered
- Lexical analysis (tokenizing)
- Syntactical analysis (parsing)
- Code generation
- Code optimization
Assignments and software
The CCSS COMP 3002 Forum will be a good place to ask and answer questions about assignments. I'll be monitoring the forum. Students are encouraged to help each other by sharing test code (but not assignment code) on the forum.
Assignments will be posted here when they are ready. For now, these are the due dates for the assignments:
Assignments in this course will be programming assignments in Java.
For the first assignment you will be asked to make modifications to a
simple interpreter that I have hand-coded in Java. For subsequent
assignments, you will be working with JavaCC, an automated parser
The following are sites at which you can download software and
documentation you will need for this course. All of this software is
sufficiently well-documented, so I don't offer any installation
- In the third and fourth assignments, you will be working
with the Jasmin
JVM assembly language.
- If you don't have it already, you will need the Java SDK.
- For the second and third assignments you will be using SiCC.
Most of the material I will teach is taken from the famous Red Dragon Book:
This book has been
- Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman. Compilers:
Principles, Techniques and Tools. Addison-Wesley, reprinted in 1998.
updated with a second edition and is now available as
These are both very good books for compiler front-end theory.
Unfortunately, even the second edition is lacking when it comes to modern
compiler work. I don't recommend buying either book unless you can pick
up a used copy cheap.
- Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman. Compilers:
Principles, Techniques and Tools. Addison-Wesley, Second Edition, 2007.
The in-class slides are here. These are constantly being updated. In
particular, before each class I will revise the slides for that class.
- Introduction to compilers
- Recursive descent parsing
- Demo compiler overview
- Lexical analysis (tokenizing)
- Parsing (including LL(1) grammars)
- Shift-reduce (LR) parsing
- Intermediate code generation and type checking
- Scope and Code Generation
- The Java Virtual Machine
- Basic Blocks, flow graphs and simple code optimization
- Basic blocks as DAGs, peephole optimization, and graph coloring
- Ershov numbers and data-flow analysis
- The GNU Compiler Collection
The Cathedral and the Bazaar
- Compilers and security
(odp, pdf, additional info)
- History and context
- Want to build a compiler?
- Old final exam
Grades will be assigned using the following grading scheme.
I may, at my discretion, increase the grades of certain students to
raise the class average or change the distribution. This will never
cause a student's grade to go down, nor will it change the relative
rankings of students so, e.g., it is not possible for a student who
earned an 80% to receive a lower grade than a student who earned a
Policy regarding unoriginal work
Students are encouraged to collaborate on assignments, but at the
level of discussion only. That is, they may work together to solve
problems and discuss their solutions, but when writing code should do
so on their own. No student should show another student his or her
Any student who is caught submitting work that they did not do
themselves will have all relevant material sent to the Dean, who will
determine the students fate. Possibilities punishments include receiving
reduced marks, no marks, expulsion from the course, suspension and/or
expulsion from Carleton University, and so on, at the discretion of the
Students with Special Needs
Students with special needs should obtain documentation from the
Paul-Menton Center and notify me as soon as possible.