Compiler Construction
Fall 2009

 

Textbook :
book cover   Compilers: Principles, Techniques, and Tools, 2/E
Alfred V. Aho, Monica S. Lam,
Ravi Sethi, Jeffrey D. Ullman
Publisher: Addison-Wesley, 2007
ISBN-10:0321486811
ISBN-13:9780321486813


Schedule :

Announcements:

I will be available in my office tomorrow (6 Bahman 1388) from 16:00 pm to 17:30 pm to answer your questions.


Grading

Homework and programming assignments: 25%
Midterm exam: 30%
Final exam: 40%
Class participation: 5%

Previous Exams

Fall 2005 - Midterm (First semester of 84-85)
Fall 2005 - Final (First semester of 84-85)
Spring 2005 - Midterm (2nd semester of 84-85)
Spring 2005 - Final (2nd semester of 84-85)
Fall 2006 - Midterm (First semester of 85-86)
Fall 2006 - Final (First semester of 85-86)
Spring 2006 - Midterm (2nd semester of 85-86)
Spring 2006 - Final (2nd semester of 85-86)
Fall 2007 - Midterm (First semester of 86-87)
Fall 2007 - Final (First semester of 86-87)
Spring 2008 - Midterm (2nd semester of 86-87)
Spring 2008 - Final (2nd semester of 86-87)

Lecture Slides

1- Anatomy of a Compiler:

This set of slides takes 2-3 sessions of our class. In these sessions we speak about anatomy of a compiler and glimpse each phase of compilation. We introduce lexical analysis, syntax analysis, semantic analysis, intermediate code generation, and code optimization, and examine each of them in an example. Here you can download the color slides and here you can find the b/w slides which is more suitable for printing.

2- Lexical Analysis:

This set of slides takes 2 sessions of our class. We learn how one can build lexical analyzer using regular grammars and finite automata. Here you can download the color slides and here you can find the b/w slides which is more suitable for printing.

3- Syntax Analysis - Top Down Parsing:

We invest 3 sessions on this set of slides. We start discussing on context free grammars (CFGs) and use them to make a syntax analyzer. For this we first study "grammar ambiguity", "left recursion", and "common left factor" in CFGs. We also introduce a family of grammars called LL(1). Next we learn how to build a top-down parser. We study two ways for building a top-down parser. The first is "recursive descent predictive" method, and the second one is "table driven" method. Download the color slides, or the b/w slides.

4- Syntax Analysis - Bottom up Parsing (1):

This set of slides takes 1 to 2 sessions. We start learning Bottom up Parsing and we see how a Shift Reduce Parser works. We also introduce the problems a shift reduce parser may encounter (Shift-Reduce & Reduce-Reduce Conflict). Finally, we see the Parse Table with which the parser performs its tasks. Download the color slides, or the b/w slides.

5- Syntax Analyser - Bottom up Parsing (2)

In the sessions we use this set of slides, we will see how LR(0) parsers work.We also learn how to construct the LR(0) parse table. We also introduce different kinds of LR parsers, and compare the LR and LL parsers. Download the color slides, or the b/w slides.

6- Syntax Analyser - Bottom up Parsing (3)

This set of slides are about SLR(1) parsers. We see what the defec of LR(0) is and learn how SLR(1) parsers improve this flaw using the notion of the follow sets. Download the color slides, or the b/w slides.

7- Syntax Analyser - Bottom up Parsing (4)

Download the color slides, or the b/w slides.

8- Semantic Analysis and Intermediate Code Gen (1)

In this set of slides we study attribute grammars. We need some context sensivity by which we are able to process issues such as type checking and conde generation in pls. AGs has this power and we use it to perform semantic analysis phase of compilation. Download the color slides, or the b/w slides.

9- Semantic Analysis and Intermediate Code Gen (2)

Download the color slides, or the b/w slides.

Teaching Assistant

Mostafa Jalambadani is the TA for this course.
book cover
Mostafa Jalambadani

Some Useful Links