Announcements
12/15: There is a small error in the solution of Question 1.4b on last year's final. I interchanged y and z. The given table shows the transition function for x = z - y, not x = y - z.

12/14: Solutions to PS 8 have been posted.

12/13: The solutions to last year's final are here.

12/10: The final exam is Friday, December 17th, 8–10am, in RAWL 1062. The final will be cumulative, but will focus mostly on the material we have covered in the last 1/3rd of the course (Lectures 9–12). Last year's final can be found here. Solutions will be posted early next week.

12/5: Online course evaluations are now available for this class. To encourage participation in the evaluation, if total class participation exceeds 80%, everyone will receive 2 bonus points on their final exam. If total class participation exceeds 90%, everyone will receive 5 bonus points.

12/1: Chenguang will be holding additional office hours on Thursday and Friday this week to help people with project step 7. He will be in EE 306 from 6:30–8:30 on Thursday and 5–7 on Friday.

12/1: Problem Set 8 has been posted. It is due the last day of class (12/10). The last day of class will also serve as a review session for the final exam.

11/29: I have written up a set of "hints" to help you get started with step 7 of the project.

11/19: The due date for Problem Set 7 has been pushed back to November 29th (the Monday after Thanksgiving).

11/12: I will be returning exam 2 today in class. The exam key is available here. The grading rubric is available here. If you feel that your exam was graded incorrectly, you have until next Friday to send me an e-mailed request for a regrade. Non-emailed requests will not suffice.

11/8: There were a couple of missing labels in Problem Set 6. An updated version has been uploaded.

10/31: Problem set 5 solutions are now available. If you want to get a head start on studying for the exam, take a look at problems 1–3 on this homework (with solutions). You might also find last year's exam useful. Focus on Problems 1.1, 1.3, 2.1–2.3, and 3.1–3.5. The solutions are here.

10/26: Lecture is cancelled on Wednesday (10/27). Instead, we will have lab hours during regular class time, in EE 306.

10/15: The project webpage is a little unclear about what is expected for step 4. You do not have to implement control structures for step 4. Those will be implemented in step 5.

10/15: The deadline for project step 4 has been moved to Monday at midnight.

10/12: The TA will be holding supplemental office hours this week, on Wednesday night, from 7pm–8pm in EE 306.

10/08: I will be returning exams today in class. The exam key is available here. The grading rubric is available here. If you feel that your exam was graded incorrectly, you have until next Friday to send me an e-mailed request for a regrade. Non-emailed requests will not suffice.

09/25: I will be putting up additional problem sets on Monday to help you prepare for the exam (which is Thursday!) If you would like to get a head start on preparation, you can check out problem sets 1, 2 and 3 from last year's edition. You can also look at midterm 1 from last year (except for part 6). The solutions are here.

09/13: To make it easier for you to keep track of due dates, office hours, etc. for the class, I have put up a web calendar. You may find it useful to subscribe to it.

09/11: The NFA for ((01)+|(11)+)*, which we used in the NFA to DFA to reduced DFA example we worked in class is here. If you want to see the steps used to construct it, as well as the subset construction used to turn it into a DFA, and then reduce it, see here (the answer to problems 3, 4 and 5).

09/07: Problem Set 2 posted. Note due date!

08/18: Syllabus posted! Note the midterm times now!

07/28: Syllabus and project descriptions coming soon!
Course Description

This course focuses on the tools and techniques needed to build an optimizing compiler. Topics include:

1. Scanning and parsing: determining the syntactic structure of a program
2. Semantic routines: determining the semantics of a program and building an intermediate representation
3. Code generation: emitting assembly code that is equivalent to the program
4. Program optimizations: improving the performance of a program
5. Program analysis: determining interesting information about a program's behavior
6. Why we shouldn't be like Mel.
Course Details
 Instructor: Milind Kulkarni milind 'at' purdue 'dot' edu Office hours: Mondays, 1:30–2:30, Tuesdays, 3:00–4:00, and by appointment. EE 324A TA: Chenguang Sun ee468 'at' ecn 'dot' purdue 'dot' edu Office Hours: 7–9pm, Tuesdays, 8–9pm, Thursdays EE 306 Class Time: Mondays, Wednesdays and Fridays, 12:30–1:20 Location: ME 118

A calendar for the class, showing lecture times, office hours, due dates and supplementary office hours is here.

Course Information

The course syllabus discusses most of the details of the course, including a tentative schedule of topics, a brief description of the project and other administrative information.

Project information
The project webpage is live.
Lecture Notes
• Lecture 1: What is a Compiler? (PDF. Also available 6-to-a-page.)
• Lecture 2: MICRO: A Simple Compiler (PDF. Also available 6-to-a-page.)
• Lecture 3: Regular Expressions, Finite Automata and Scanners (PDF. Also available 6-to-a-page.)
• Lecture 4: Parsers (PDF. Also available 6-to-a-page.)
• Lecture 5: Declarations and Expressions (PDF. Also available 6-to-a-page.)
• Lecture 6: Control structures (PDF. Also available 6-to-a-page.)
• Lecture 7: Functions (PDF. Also available 6-to-a-page.)
• Lecture 8: Code generation and local optimizations (PDF. Also available 6-to-a-page.)
• Bonus Lecture: Register allocation via graph coloring (PPT. Slides courtesy Andrew Myers.)
• Lecture 9: Control flow graphs and loop optimizations (PDF. Also available 6-to-a-page.)
• Lecture 10: Intro to dataflow analysis (PDF. Also available 6-to-a-page.)
• Lecture 11: Bitvector dataflow analysis (PDF. Also available 6-to-a-page.)
• Lecture 12: Dependence analysis and loop optimizations (PDF.) Also available 6-to-a-page.)
Problem Sets

Problem sets are due on the date shown. You may submit them by email before class, or turn in a hard copy at the beginning of class. (Not the end!)