COMP 520 Compiler Design

Fall 2012

This website is still being updated, but the content is mostly correct.

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.

Announcements:

  • 2012-12-08: Sample final solutions here.
  • 2012-11-22: Added some sample final questions here.
  • 2012-10-15: Updated midterm date: October 26 (still in-class).
  • 2012-10-12: Added link to paper about bytecode verification under section for week 8.
  • 2012-09-21: Updated Tiny example milestone to say you should use SableCC3, not SableCC2.
  • 2012-09-14: Midterm date posted: October 23 (in-class).
  • 2012-09-07: Some interesting links about scanning were added under the section for Week 2.

About this course

Official course description
Philosophy of the course
Availability

People

Lecturer (Ismail Badawi)
Teaching assistant (Vineet Kumar)

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 2012
 S  M Tu  W Th  F  S
          5  6  7  8
             *  *  

Slides, 4-on-1

Exercises

Reading C1: Louden, Chapter 1
Reading C2: Appel, Chapter 2
Reading O1: 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
Chapters 1 and 2 of Version Control with Subversion.

Week 2: Scanners and parsers

   September 2012
 S  M Tu  W Th  F  S
 9 10 11 12 13 14 15
       *     *  *

Slides, 4-on-1

Exercises

Reading C3: Louden, Chapter 3
Reading C4: Appel, Chapter 3.2-3.5

Standalone lexers with lex: synopsis, examples, and pitfalls
Lexical Scanning in Go - Rob Pike (51:17)
Generating Good Syntax Errors

Week 3: Abstract syntax trees and SableCC

   September 2012
 S  M Tu  W Th  F  S
16 17 18 19 20 21 22
       *     *  * 

Slides, 4-on-1
SableCC Slides

Tiny expression language source code

Exercises

Reading O2: Bison
Reading O3: SableCC, Gagnon, Chapters 3-6

WIG milestone: form groups and begin planning

Week 4:

   September 2012
 S  M Tu  W Th  F  S
23 24 25 26 27 28 29
       *     *  * 

Slides, 4-on-1

Exercises

WIG milestone: Try out each toolset on a Tiny example

Week 5:

    October 2012
 S  M Tu  W Th  F  S
    1  2  3  4  5  6
       *     *  *

Slides, 4-on-1

Exercises

JOOS deliverable: benchmark programs
JOOS deliverable: comments and desugaring

Reading O4: HTML
Reading O5: CGI

Week 6: Symbol tables

    October 2012
 S  M Tu  W Th  F  S
 7  8  9 10 11 12 13
       *     *  *

Regular Lecture slides: Slides, 4-on-1

Special lecture slides: Slides, 4-on-1

Exercises

WIG milestone: CGI vs. WIG

Reading C5, Louden, Chapter 6.3

Week 7: Type checking

    October 2012
 S  M Tu  W Th  F  S
14 15 16 17 18 19 20
       *     *  *

Slides, 4-on-1

Exercises

WIG milestone: scanner and parser

Reading C6, Louden, Chapter 6.4

Week 8: Virtual machines

    October 2012
 S  M Tu  W Th  F  S
21 22 23 24 25 26 27
       *     * **
               midterm

Slides, 4-on-1

Exercises

WIG milestone: symbol tables

Java bytecode verification: algorithms and formalizations
A Denial of Service Attack on the Java Bytecode Verifier
COMP523 report on bytecode verification and the above exploit

Week 9: Code generation

    October 2012
 S  M Tu  W Th  F  S
28 29 30 31 
       *   

	November 2012
 S  M Tu  W Th  F  S
             1  2  3
             *  *

Slides, 4-on-1

Exercises

WIG milestone: type checking

midterm

Week 10: Optimization

   November 2012
 S  M Tu  W Th  F  S
 4  5  6  7  8  9 10
       *     *  *

Slides, 4-on-1

Exercises

JOOS deliverable: stack limits

Week 11: Garbage collection

   November 2012
 S  M Tu  W Th  F  S
11 12 13 14 15 16 17
       *     *  *

Slides, 4-on-1

Exercises

Reading C7, Appel, Chapter 13

Week 12: Native code generation

   November 2012
 S  M Tu  W Th  F  S
18 19 20 21 22 23 24
       *     *  *

Slides, 4-on-1

JOOS deliverable: peephole patterns

Week 13: Static analysis

   November 2012
 S  M Tu  W Th  F  S
25 26 27 28 29 30
       *     *  *

WIG deliverable: compiler
WIG deliverable: report

Slides, 4-on-1

Reading C8: Appel, Chapter 10

Week 14: Presenting your compilers

   December 2012
 S  M Tu  W Th  F  S
 2  3  4  
       * 
Group meetings will be scheduled on Monday and Tuesday.

Maintained by Ismail Badawi [HOME]