COMP 520 Compiler Design

Fall 2007

Some of the links to future exercises, deliverables, milestones, and slides are broken but will be updated in due time. All other links should work, so kindly email us if there are problems.

Please refer to this web page weekly to review the course material and to check for updated links. All class members are encouraged to follow changes to the public_html directory using Subversion; all important announcements will be made in class or via email.

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 http://www.mcgill.ca/integrity/ for more information). A helpful article on how to avoid plagiarism can be found at: http://www.mcgill.ca/integrity/studentguide/.

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.

About this course

Official course description
Philosophy of the course
Availability

People

Lecturer (Chris Pickett)
Teaching assistant

Printed Readings

Course text (readings)
Lecture notes

Deadlines and Important Dates

Deliverables, milestones, and exercises
Week by week schedule
Midterm

Project

The project description
The A- source code (flex/bison/C)
The A- source code (SableCC/Java)
The A+ project
The A+ binary
JOOS examples
JOOS library source
JOOS extern classes

How to run Java and JOOS programs

How to use Subversion

Project

The project description
Original WIG grammar
Yacc-style grammar, most conflicts solved
Sablecc-style grammar (version 2)
How to run SableCC
WIG examples
How to compile and run WIG services

The <bigwig> project
The Mawl project

Peephole contest

Rules and prizes
Results and Winners

Online documentation

The flex scanner generator
The bison parser generator
The SableCC compiler generator
The Java language specification
The Java virtual machine
The Java API documentation

HTML User Guides
CGI Programming
The HTML 4.0 specification
The CGI specification

Under The Hood articles:


Week by week

Week 1: Introduction and Scanners

   September 2007
Su  M Tu  W Th  F Sa
 2  3  4  5  6  7  8  
          *     *

Slides, 4-on-1
Plus the first 9 slides from Week 2.

Exercises

Reading 1: Louden, Chapter 1
Reading 2: Appel, Chapter 2
Reading 3: Flex

Students who do not have a background in regular languages and finite state automata should review this material on their own. A good online resource may be found here. This review should be done ASAP. Additionally, all students must read ALL of the material in the Chapters 1 and 2 of Version Control with Subversion.

Week 2: Scanners and parsers

   September 2007
Su  M Tu  W Th  F Sa
 9 10 11 12 13 14 15 
    *     *     *

Slides, 4-on-1

Exercises

Reading 4: Louden, Chapter 3
Reading 5: Appel, Chapter 3.2-3.5

Week 3: Abstract syntax trees and SableCC

   September 2007
Su  M Tu  W Th  F Sa
16 17 18 19 20 21 22 
    *     *     * 
Clark Verbrugge will teach on the 17th and 19th.

Slides, 4-on-1
SableCC Slides

Tiny expression language source code

Exercises

Reading 6: Bison
Reading 7: SableCC, Gagnon, Chapters 3-6

WIG milestone: form groups and begin planning

Week 4:

   September 2007
Su  M Tu  W Th  F Sa
23 24 25 26 27 28 29
    *     *     * 

Slides, 4-on-1

Exercises

WIG milestone: Try out each toolset on a Tiny example

Week 5:

   September 2007
Su  M Tu  W Th  F Sa
30

    October 2007
Su  M Tu  W Th  F Sa
    1  2  3  4  5  6  
    *     *     *

Slides, 4-on-1

Exercises

JOOS deliverable: benchmark programs
JOOS deliverable: comments and desugaring

Reading 8: HTML
Reading 9: CGI

Week 6: Symbol tables

    October 2007
Su  M Tu  W Th  F Sa
 7  8  9 10 11 12 13 
    H  *  *     *
Monday, October 8th is a holiday. Class is rescheduled for the same time on Tuesday, October 9th.

Slides, 4-on-1

Exercises

WIG milestone: CGI vs. WIG

Reading 10, Louden, Chapter 6.3

Week 7: Type checking

    October 2007
Su  M Tu  W Th  F Sa
14 15 16 17 18 19 20 
    *     *     *

Slides, 4-on-1

Exercises

WIG milestone: scanner and parser

Reading 11, Louden, Chapter 6.4

Week 8: Virtual machines

    October 2007
Su  M Tu  W Th  F Sa
21 22 23 24 25 26 27
    *     *     *

Slides, 4-on-1

Exercises

WIG milestone: symbol tables

Week 9: Code generation

    October 2007
Su  M Tu  W Th  F Sa
28 29 30 31
   **     *
(midterm)

   November 2007
Su  M Tu  W Th  F Sa
             1  2  3
                *

Slides, 4-on-1

Exercises

WIG milestone: type checking

midterm

This year it is a closed book midterm.

Week 10: Optimization

   November 2007
Su  M Tu  W Th  F Sa
 4  5  6  7  8  9 10  
    *     *     *

Slides, 4-on-1

Exercises

JOOS deliverable: stack limits

Week 11: Garbage collection

   November 2007
Su  M Tu  W Th  F Sa
11 12 13 14 15 16 17 
    *     *     *

Slides, 4-on-1

Exercises

Reading 12, Appel, Chapter 13

Week 12: Native code generation

   November 2007
Su  M Tu  W Th  F Sa
18 19 20 21 22 23 24 
   **     *     *
(peepholes)

Slides, 4-on-1

JOOS deliverable: peephole patterns

Note the deadline on MONDAY!

Week 13: Static analysis

   November 2007
Su  M Tu  W Th  F Sa
25 26 27 28 29 30  
    *     *     * 

Slides, 4-on-1

Reading 13: Appel, Chapter 10

Week 14: Presenting your compilers

   December 2007
Su  M Tu  W Th  F Sa
 1  2  3  4  5  6  7
   **
(project)
Wig compiler and report due on Monday by noon
(Group meetings will be scheduled on Wednesday and Friday)
(No lectures)

Meetings of Groups

WIG deliverable: compiler
WIG deliverable: report

Maintained by Christopher J. F. Pickett [HOME]