CS406: Compilers
Spring 2020
Mondays 4PM-4:55PM
Wednesdays 8:30AM-9:25AM and 2:30PM-3:25PM.
Room 211
About the Course
Description:
This course focuses on the principles of compiler design and implementation. Topics include:
- Scanning and parsing: determining the syntactic structure of a program
- Semantic routines: determining the semantics of a program and building intermediate representation
- Code generation: emitting equivalent assembly code for the program
- Optimizations: improving the performance of a program
- Program analysis: determining interesting information about program's behavior
Details:
The course syllabus discusses most of the details of the course, including a tentative schedule of topics, exam dates, and other administrative information. Announcements, assignment links, and grades will be posted on Moodle. We will be using Piazza for online discussion of the lectures and assignments. If you have a question about a concept covered in lecture or about a detail of an assignment, check Piazza first!
Instructor:
Nikhil Hegde
nikhilh 'at' iitdh 'dot' ac 'dot' in
Office hour: Tuesdays 1:30PM to 2:30PM, Wednesdays 3:30PM to 5:30PM
Office: ground floor faculty cabins
Lecture Schedule and Notes
Some of the slides are courtesy of Prof. Kulkarni.
- Weeks 1 and 2 (6/1 and 13/1): Syllabus, Course Overview, Structure of a Compiler; Slides
- Week 3: Lexical Analysis Slides
- Week 4: Parsing Slides
- Week 5: Parsing, AST, Semantic Routines (expressions) Slides
- Week 6: Semantic Analysis and Code Generation Slides
- Week 7: Code Generation (For loop, Switch statement, Function Parameter Types) Slides, Midterm Review Sample Questions with Answers
- Week 8: Mid-sem exam week exam, Solutions
- Week 9: Code Generation (Function Calls), Local Optimizations - Peephole optimizations (Slides to be uploaded)
- Week 10: Local Optimizations (CSE, Register Allocation), Instruction SchedulingSlides
- Week 11: Revision - written assignment on register allocation and instruction scheduling
- Week 12: Programming Assignment 5 on Function Calls
- Weeks 13 and 14 (Planned): (30/3 to 8/4): Dataflow Analysis, Control Flow Graphs, Dataflow Analysis - Constant Propagation, Dataflow Analysis - Liveness
- Weeks 14 and 15 (Planned): (8/4 to 17/4): Loop Optimizations and Dependence Analysis
Homework Assignments and Exams
All homework assignments are due at 11:59PM unless otherwise announced. Assignment and exam details will be posted during the semester.
- Homework assignment 0: Team formation, Git submission process PA0, Due 15/1/2020.
- Homework assignment 1: Lexical analyzer PA1, Due 29/1/2020.
- Homework assignment 2: Parser PA2, Due 13/2/2020.
- Homework assignment 3: Symbol Tables PA3, Due 4/3/2020 (extended: 9/3/2020).
- Homework assignment 4: Statements and Expressions PA4, Due 20/3/2020 (extended 31/3/2020).
- Written assignment 1 (5 points): Register Allocation and Instruction Scheduling, Due when classes resume after COVID-19 restrictions are relaxed. Solution
- Homework assignment 5: Function Calls PA5, Due 10/4/2020.