Schedule (Tentative!)
- Stuff listed in bold indicates a due date of some sort, attached to a grade item that will influence your final grade. See Assessment for more details.
- As there is no required text, most readings are "recommended" readings. The term "A c" refers to the text by Appel. The term "C c" refers to the text by Cooper. The term "W c" refers to the text by Wirth. For example, "A 3" refers to chapter 3 in Appel, while "W 3.1" refers to section 1 in chapter 3 in Wirth. Note that the readings don't always "match up" with the lectures very well, so the chapters given are approximations. You are expected to do the assigned reading before a topic is covered in lecture; reading assigned in the week of an exam is part of the exam! Please try to read ahead, you'll be surprised how much more sense the lectures make...
Week 1: Introduction and Overview (January 26 – February 1)
Lecture:
- Monday: Welcome to Compilers and Interpreters!
- Wednesday: Compiler Architecture
- Friday: Review of Formal Languages
Reading:
- Recommended: A 1, C 1, W 1; Instant Python Tutorial; LaTeX Introduction; ACM Code of Ethics and Professional Conduct
Tasks:
- Monday: Grab Assignment 1 and get started.
- Wednesday: Introduce yourself on the course mailing list.
Week 2: Lexical Analysis (February 2 – February 8)
Lecture:
- Monday: Introduction to Lexical Analysis, Review of Finite Automata
- Wednesday: Implementing Scanners
- Friday: The Cycle of Constructions
Reading:
- Recommended: A 2, C 2, W 2/3; Subversion; Graphviz, DevCenter Tutorial on Graphviz
Resources:
- Some test cases for Assignment 2.
Tasks:
- Monday: Turn in your solution to Assignment 1 before lecture, then relax.
- Monday: Grab Assignment 2 and get started.
Week 3: Syntactic Analysis (February 9 – February 15)
Lecture:
- Monday: Introduction to Syntactic Analysis
- Wednesday: Implementing Recursive Descent Parsers
- Friday: Parse Trees and the Observer Pattern
Reading:
- Recommended: A 3, C 3, W 4/7
Resources:
- Sample scanner implementations in Python and C++. Use at your own risk!
- Some test cases for Assignment 3.
Tasks:
- Monday: Turn in your solution to Assignment 2 before lecture, then relax.
- Monday: Grab Assignment 3 and get started.
- Friday: In lecture we discussed the use of the Observer pattern to visualize the concrete syntax tree during parsing. Discuss potential problems with this approach on the course mailing list, and suggest a better solution that is still language independent. If you can't find a problem, describe a particular language feature in your implementation language that makes the Observer pattern easy to apply (but if you do that you must come up with a language feature nobody mentioned before).
Week 4: Semantic Analysis (February 16 – February 22)
Lecture:
- Monday: Introduction to Semantic Analysis, Attribute Grammars, Introduction to Symbol Tables
- Wednesday: More on Symbol Tables, Object-Oriented Design
- Friday: Visualization and the Visitor Pattern
Reading:
- Recommended: A 4/5, C 4, W 5/8
Resources:
- Sample parser implementations in Python and C++. Use at your own risk!
- Some test cases for Assignment 4.
Tasks:
- Monday: Turn in your solution to Assignment 3 before lecture, then relax.
- Monday: Grab Assignment 4 and get started.
Week 5: More Semantic Analysis and Midterm! (February 23 – March 1)
Lecture:
- Monday: Concrete vs. Abstract Grammars, Introduction to Abstract Syntax Trees, Object-Oriented Design, Generation of Abstract Syntax Trees
- Wednesday: More on Abstract Syntax Trees, Simple AST Transformations, Type Checking (occurrence vs. structure)
- Friday: Midterm 1
Reading:
- Recommended: A 4/5, C 4, W 5/8/16.5
Resources:
- Sample symbol table implementations in Python and C++. Use at your own risk!
- Some test cases for Assignment 5.
- Exams from Spring 2006: Midterm 1 Midterm 2
Tasks:
- Monday: Turn in your solution to Assignment 4 before lecture, then relax.
- Monday: Grab Assignment 5 and get started.
Anything below this line is in a state of flux and useless!
Week 6: Semantic Analysis (October 15 – October 21)
Lecture:
- Monday: No Class! Fall Break Day!
- Wednesday: More Fun with Abstract Syntax Trees
- Friday: Midterm Exam
Reading:
- Recommended: A 4/5, C 4, W 5/8/16.5
Resources:
Week 7: Interpreting Simple / Code Generation (October 22 – October 28)
Lecture:
- Monday: Introduction to Interpreters
- Wednesday: More on Interpreting Simple
- Friday: Introduction to the MIPS architecture and the SPIM simulator
Reading:
- Recommended: James Larus: Assemblers, Linkers, and the SPIM Simulator (PDF)
- Recommended: Bradley Kjell: Programmed Introduction to MIPS Assembly Language, 2004
Resources:
Tasks:
- Monday: Turn in your solution to Assignment 5 before lecture, then relax.
- Monday: Grab Assignment 6 and get started.
- Thursday: Suggest a way to simplify Simple such that the interpreter would be simpler to write, but the language itself wouldn't suffer any significant loss of expressiveness. If you can't come up with anything, you can either demolish someone else's suggestion, or you can explain why there's nothing left to simplify in Simple.
Week 8: Code Generation (October 29 – November 4)
Lecture:
- Monday: Introduction to Storage Allocation, Code Patterns for Number, Variable, and Expression Nodes
- Wednesday: Storage Allocation and Alignment, Storage Allocation for Arrays, Code Patterns for Assignment, If, Repeat, Read, and Write Nodes
- Friday: Storage Allocation for Records, Code Patterns for Index and Field Nodes, Tricks to minimize bounds checking code
Reading:
- Recommended: James Larus: Assemblers, Linkers, and the SPIM Simulator (PDF)
- Recommended: Bradley Kjell: Programmed Introduction to MIPS Assembly Language, 2004
Resources:
- Some test cases for Assignment 7. Not to be taken literally, lecture material takes precedence!
Tasks:
- Monday: Turn in your solution to Assignment 6 before lecture, then relax.
- Monday: Grab Assignment 7 and get started.
Week 9: Better Code Generation (November 5 – November 11)
Lecture:
- Monday: Register Stacks to avoid push/pop cascades in expressions, Register Allocation as a caching problem across instructions
- Wednesday: Sethi-Ullman algorithm, Delayed Code Generation using Wirth's Items technique
- Friday: TBD
Reading:
- Recommended: James Larus: Assemblers, Linkers, and the SPIM Simulator (PDF)
- Recommended: Bradley Kjell: Programmed Introduction to MIPS Assembly Language, 2004
- Optional: Sethi-Ullman Algorithm (cites original paper as well)
Tasks:
- Monday: Turn in your solution to Assignment 7 before lecture, then relax.
- Monday: Grab Assignment 8 and get started. Make sure you also check out the competition for the best code generator. :-)
Week 10: Procedures (November 12 – November 18)
Lecture:
- Monday: Adding Procedures, Changes to the frontend (scanner, parser), Changes to the intermediate representation (symbol table, abstract syntax tree), Language Design Issues
- Wednesday: Wrapping up intermediate representation, Generating code for procedures, Activation frames (simple, including locals, and including parameters)
- Friday: Reference parameters for structured types, nested procedures and static vs. dynamic scoping, Outlook on procedure variables and closures
Reading:
- Recommended: James Larus: Assemblers, Linkers, and the SPIM Simulator (PDF)
- Recommended: Bradley Kjell: Programmed Introduction to MIPS Assembly Language, 2004
Tasks:
- Monday: Turn in your solution to Assignment 8 before lecture, then relax.
- Monday: Grab Assignment 9 and get started.
Week 11: Language Extensions (November 19 – November 25)
Lecture:
- Monday: Pointer Types and Dynamic Memory Allocation; Specialized FOR Loops for Efficient Array Traversal; Variations of Pascal's WITH Instruction for Explicit Common Subexpressions in Address Computations; Adding REAL Type, Values, and Operations including Type Conversions
- Wednesday: Adding BOOLEAN Type, Values, and Operations; Adding Exception Handling
- Friday: No class! Prepare for turkey and stuffing... :-)
Reading:
- Recommended: John Gough et.al.: Implementing Zero-Overhead Exception Handling, 1995.
Week 12: Advanced Code Generation (November 26 – December 2)
Lecture:
- Monday: Basics of Control Flow Graphs, Basic Blocks, Three-Address Instructions
- Wednesday: Introduction to Static Single Assignment Form, Explicit versus Implicit Names
- Friday: Definitions and Uses, Constructing Static Single Assignment Form for Structured Languages
Reading:
- Required: Marc Brandis, Hanspeter Mössenböck: Single-Pass Generation of Static Single Assignment Form for Structured Languages, 1994.
- Recommended: John Aycock, Nigel Horspool: Simple Generation of Static Single-Assignment Form, 2000.
Tasks:
- Monday: Turn in your solution to Assignment 9 before lecture, then relax.
- Monday: Grab Assignment 10 and get started.
Week 13: Advanced Code Generation (December 3 – December 9)
Lecture:
- Monday: Simple Dead Code Elimination, Simple Constant Propagation (and Folding and more...)
- Wednesday: Conditional Constant Propagation (and Folding), Special Thanks to Matt! :-)
- Friday: Live Ranges, Interference Graphs, Register Allocation using Graph Coloring, TBD
Week 14: Famous Last Words (December 10)
Lecture:
- Monday: Review for Final, Outlook on Fancier Compilers, Stump the Chump
Resources:
- Old Final Exams: Spring 2007 Spring 2005
Tasks:
- Monday: Turn in your solution to Assignment 10 before lecture, then relax (a lot since you're done).