CIS 341 - Compilers
Fall 2008


Topics     Reading     Projects     Grading     Schedule     Policies

Time: MWF 11:00 - noon
Room: Towne 321

Instructor:

  Steve Zdancewic
      e-mail: cis341 (AT) seas.upenn.edu
      office hours: Tues. 9:30-10:30 (and by appointment) Levine 511

Teaching Assistant:

  Luke Zarko
      e-mail: cis341 (AT) seas.upenn.edu
      office hours: Mon. 3:30-4:30 (and by appointment) Moore 100

Course contact information:

  Class mailing list: CIS341-001-08C (AT) lists.upenn.edu (open to all members of the class)

Prerequisites: CIS 121 and CIS 240


Topics:

  • Lexing/Parsing
  • Code generation
  • Semantic analysis
  • Optimization
  • Run-time support

Reading and References

The following books contain useful course material, and much of the lecture content is derived from them (and other sources). Copies of these books are on reserve in the Penn Engineering Library.

  • Compilers (2nd edition) by Aho, Lam, Sethi, and Ullman
  • Advanced Compiler Design and Implementation by Muchnick
  • Modern Compiler Implementation in ML by Appel

In addition, the following papers and web sites provide supplementary material. Reading selections from these sources will be announced in class.

Projects: The Quaker OAT Compiler

There are a total of 8 projects. Project 0 is an individual project. The rest of the projects are group projects -- students may work alone or in pairs for them.

Here are instructions for getting access to the tools you need to complete course assignments.


Grading Criteria

  • 10%   Midterm I - tentative date: 10/20/08
  • 10%   Final exam - date to be determined by registrar
  • 80%   Course projects (group projects)

Lecture Slides and Notes

Note: The following schedule is tentative!
Many of the slides in these lectures have been adapted from course materials by Andrew Myers at Cornell University and Greg Morrisett at Harvard University.

Schedule

Date
Topic
Notes
9/1

Labor Day
9/3
Introduction to Compilers
First Day of Class
9/5
OCaml Part I
lec2.ml
9/8
OCaml Part II
Code from lecture 3
9/10
X86lite Assembly

9/12
Lexing (piglatin.mll)(handlex.ml)
Project 0 due!
9/15
Parsing I: CFGs

9/17
Parsing II: LL(k) (parser.ml)

9/19
Parsing III: LR(k)
Project 1 due
9/22*
ocamllex and ocamlyacc

9/24*
Basic Code Generation

9/26
Intermediate Representations I (translate.ml)

9/29
Local Variables & Control Flow
Project 2 due
10/1
Optimizing Control / Procedures

10/3
Compiling Datatypes

10/6
First-class Functions I (fun.ml)

10/8
Closure Conversion / Type Checking I

10/10
Type Checking II (fun.ml)
Project 3 due
10/13
No Class
Fall Break
10/15
Types, Static Analysis, Type Checking III

10/17
Subtyping

10/20*

Midterm
10/22
Modularity and Encapsulation

10/24
Objects and Classes I
Project 4 due
10/27
Objects and Classes II

10/29
Objects and Classes III

10/31
The OAT Language
(list.oat, encroach.oat)
11/3
Introduction to Optimization

11/5
Optimizations II / Liveness Analysis

11/7
Liveness Analysis I
Project 5 due
11/10
Dataflow Analysis I

11/12
Dataflow Analysis II

11/14
Dataflow Analysis III

11/17
Control Flow Analysis (Loops) (Paper)
Project 6 due
11/19
SSA & Register Allocation I

11/21*

No Class!
11/24
Register Allocation II

11/26
Memory Management

11/28

Thanksgiving break
12/1
Garbage Collection

12/3
Advanced topics I

12/5
Course Wrap-up
Project 7 due / Last day of class
12/10
Final Exam
noon - 2:00 CHEM 514
*indicates dates when Prof. Zdancewic will be away.

Course Policies

General Project Guidelines

  • Groups:
    Teams for group projects will consist of one or two students.
  • Late Projects:
    All projects are due at 11:59pm on the due date. Each student has 3 "grace days". Projects may be turned in until 11:59pm on the day after the due date at the expense of one grace day per group member. Projects using grace days must clearly indicate that fact in the README document. (If a group has a member with no grace days, that group may not submit the project late.) Projects may be turned in late for a legitimate reason with prior approval of the course instructor.
  • Regrade Policy:
    Regrade requests should be sent to the TA. Only reasonable requests will be considered. The entire project or exam will be regraded. Note that this means that the score on a regraded project might decrease.

Submission Policy

  • Projects that do not compile will get no credit.
  • Projects that compile will receive partial credit according to the grading guidelines provided in the project description.
  • It is fine to submit a project multiple times. Only the last project submitted will count for grading purposes.
  • All projects should include a readme.txt file that includes the following information:
    Name:
    Email:
    Approximate time (hours) spent on this assignment:
    
    Are there any bugs in your assignment that you know about but have been unable
    to fix? (This is OK to leave blank.)
    
    Was there any part of this assignment that you found particularly difficult?
    (This is OK to leave blank.)
    
    (Any other information specified in the project description.)
    

Academic Integrity

This course will abide by the University's Code of Academic Integrity. In particular, for individual projects and group projects, the following guidelines should be followed:
  • For individual projects, you must type in and edit your own code, documentation, and any other materials submitted for grading.
    • Copying someone else's file is not allowed.
    • Allowing someone else to copy a file of yours, either explicitly or implicitly by leaving your code unprotected, is not allowed.
    • Editing each other's files is not allowed
  • Regarding the ethics of what you may or may not discuss with others:
    • "High level" discussions are fine.
      For example, discussions about the problem statement.
    • "Low level" discussions are fine.
      For example, discussions about OCaml syntax or using omake, understanding compiler error messages, understanding the mechanics of the tools and libraries used for the projects.
    • "Mid level" discussions require discretion. In this CIS course, discussions at this level must be limited.  Unless explicitly stated otherwise, you may not collaborate significantly with classmates (except group project members) at this level.  If you have minor discussions with others at this level or get help from outside resources (tutors, web sites, etc), you must cite in the readme of the submitted projects the names of the people or websites who helped you and how they did. For example:
       Name: Chris Brown
       Email: ***@seas.upenn.edu
       I received tips from Jo Johnson on the i/o and example.com/mem.htm on memory
       ...
  • If there is any doubt about the use of external sources or collaboration, please ask for clarification by the course staff.