Compiler Design (COMP 520)


This course covers modern compiler techniques and their application to both general purpose and domain specific languages. The practical aspects focus on current technologies, primarily Java.


A detailed syllabus is available from the course website. This is a summary of the core topics that will be covered:
  • Deterministic parsing: LR parsers, the flex/bison and SableCC tools.
  • Semantic analysis: abstract syntax trees, symbol tables, type checking, resource allocation.
  • Code generation: resources, templates, optimizations.
  • Virtual machines and run-time environments: stacks, heaps, objects.
  • Surveys on: native code generation, static analysis, ...


Lectures: 3 hours/week. MWF 11:35--12:25, ENGTR (Trottier) 0060


Officially Required: COMP 273 (Introduction to Computer Systems), COMP 302 (Programming Languages and Paradigms). Students registering without the official prerequisites may find the course removed from their transcript by their faculty. This should not be a problem for graduate students. Speak to me if you are unsure about whether you should take the course.

Other: COMP 330 (Theoretical Aspects of Computer Science) is also recommended. Students without COMP 330 should familiarize themselves with regular and context-free languages.

This is a programming-intensive course. The primary languages used are C and Java and familiarity with them is assumed.


Eric Bodden, McConnell 234, Office hours Monday and Wednesday, 12:30--13:30, or by appointment.
Email: eric [dot] bodden [at] mail [dot] mcgill [dot] ca

Teaching Assistant:

Reehan Shaikh, Office hours TBA
Email: reehan [dot] shaikh [at] cs [dot] mcgill
[dot] ca


Assignments: 65%
Midterm: 10%
Final Exam: 25%

The 65% for the assignment marks are distributed as follows:
  • 15% for the first three JOOS deliverables (5% each)
  • 10% for the JOOS peephole optimizer
  • 20% for the content submitted at milestones
  • 20% for the WIG compiler and report submitted at the end of term (group project)
This course requires substantial group work. Contributions of each group member will be considered in grading. Marks for the final WIG compiler and report may be different for different members of a group if the contributions of group members vary significantly.


4 credits


The course text is a special collection of chapters of two very good text books, plus some supplementary material not available in standard text books. It is available as a course pack in the McGill Bookstore.
  • Compiler Construction, Kenneth C. Louden, 582 pages
  • Modern Compiler Implementation in C, Andrew W. Appel, 544 pages
In addition, students might find the following online readings useful:
  • Flex, version 2.5, by Vern Paxson
  • Bison, The YACC-compatible Parser Generator, November 1995, Version 1.25
  • SableCC: An Object-Oriented Compiler Framework, M.Sc. Thesis, McGill Unviersity, Etienne Gagnon
  • A Beginner's Guide to HTML, NCSA
  • An instantaneous introduction to CGI scripts and HTML forms, The University of Kansas, Michael Grobe
See this webpage for details.

Detailed Course Schedule and Links:

The course web page contains a detailed course schedule, links to the course notes and links to relevant software. You should visit this page often to get the most recent information.

Assignment and Exam Policy

All assignments (exercises, deliverables, milestones, and the project) are due at the beginning of class. Once groups are formed, we will be using Subversion for all group submissions. Late deliverables and milestones will generally be accepted without penalty, but you will lose points from the 5% allocated for timely submission. Note that the peephole patterns deadline is very firm since it is a class competition, and we also need the projects on time in order to prepare for the group meetings. No assignment submissions will be accepted after marked assignments have been returned or after solutions have been discussed in class.

Both exams are closed book. If you miss the midterm you will require a medical note or written permission from the instructor to reschedule it. If you miss the final you must speak to the Faculty of Science to arrange for a supplemental or deferred exam.

Academic Integrity at McGill University

McGill University values academic integrity. Therefore all students must understand the meaning and consequences of cheating, plagiarism and other academic offences under the Code of Student Conduct and Disciplinary Procedures (see for more information). A helpful article on how to avoid plagiarism can be found at:

In terms of this course, part of your responsibility is to ensure that you put the name of the author on all code that is submitted. By putting your name on the code you are indicating that it is completely your own work. If you use some third-party code you must have permission to use it and you must clearly indicate the source of the code.

In general, work submitted for this course must represent your own efforts. Copying assignments or tests, or allowing others to copy your work, will not be tolerated. Note that introducing syntactic changes into a copied program is still considered plagiarism.

Maintained by Eric Bodden. [HOME]