COMP 181 - Compilers

Fall 2009
Tufts University Computer Science

 

Class information
 

Time: Monday, Wednesday 1:30pm - 2:45pm (G+ block)
Location: Halligan Hall 106

Instructor: Sam Guyer
Office hours: Tuesdays 2-4pm (or by appointment)
Location: Halligan Hall 009 -- at end of The Chateau (extension)

   

TA: None
Office hours:
Location:

Mailing list: https://www.eecs.tufts.edu/mailman/listinfo/comp181

Description
     

This course explores the basic problems that arise in the design and construction of translators for programming languages. It focuses on both the underlying theory of compilation as well as its implementation in real systems. The course work is centered around a set of projects that involve building a substantial fragment of a realistic compiler for a simple imperative programming language.

Here is a tentative list of topics we will cover in this course:

• Lexical scanning
• Parsing
• Semantic analysis and type checking
• Intermediate representations
• The procedure abstraction
• Code generation
• Instruction scheduling
• Register allocation
• Introduction to optimization
• Value numbering, common subexpression elimination
• Other optimization problems (time permitting)
Important dates
     

Dec 1, 2009 -- Programming project part 3 due

Oct 21, 2009 -- Programming project part 2 due

Oct 13, 2009 -- Programming project part 1.5 due

Sept 23, 2009 -- Programming project part 1 due

Tufts University Academic Calendar

Lecture notes
 

Sept 21, 23 -- Lexical analysis and scanner construction [PDF]
Sept 28 -- Parsing introduction, top-down parsing, first and follow sets [PDF]
Oct 5 -- Bottom-up parsing, LR parsers [PDF]
Oct 13 -- Syntax-directed translation [PDF] -- Static checking [PDF]
Oct 21 -- Type checking [PDF]
Nov 2 -- IR Lowering [PDF]

Project
 

The programming projects in this class will involve building the major components of a compiler for a subset of Java. You will implement this system in Java, using components of a compiler infrastructure that I provide for you.

References
 

Books

Engineering a Compiler by Keith Cooper and Linda Torczon

Compilers: Principles, Techniques, and Tools by Aho, Lam, Sethi, and Ullman

Advanced Compiler Design and Implementation by Steven Muchnick

Compilers

  • GNU gcc -- really a family of compilers with multiple front-ends and back-ends.
  • LLVM -- VM-based compiler for C/C++; includes both compile-time and run-time optimization.
  • CIL -- an IR and analyzer for C written in OCAML.
  • GHC -- the Glasgow Haskell compiler.
  • MLton -- Standard ML compiler
  • JikesRVM -- research Java virtual machine (compile only, no interpreter)
  • Course work
     

    Course work will consist of two exams, homeworks, and projects.

    50%ProjectsFour or five parts, spread out over semester
    15%MidtermIn class exam
    20%FinalProbaby a take-home
    15%HomeworksA few problem sets to help solidify the material