Skip to main content

COMPILER DESIGN


buX
Enrollment is Closed

Reference Textbook: Compilers Principles, Techniques, and Tools (Second Edition) by Aho, Lam, Sethi, and Ullman


Theory Lecture Schedule

Lecture Schedules for the Midterm Exam

Lecture 1: Introduction to Compiler

The Structure and stages of the compiler

The analysis-synthesis model of compilation

Difference between a compiler and an interpreter

Reading References:

  1. https://betterprogramming.pub/compiler-vs-interpreter-d0a12ca1c1b6?gi=4ace49f83583
  2. Lesson 1 PDF file shared here
  3. Chapter 1: Sections 1.2 to 1.5 (Inclusive) of the reference textbook

Lecture 2: Introduction to Lexical Analysis

The role of a Lexical Analyzer

Tokens, Patterns, Token Attributes

Regular Definitions

The Structure of a Generated Lexical-Analyzer

Take-home assignment-1: an assessment of students’ knowledge of regular expression, RE to NFA, then NFA to DFA from Automata and Complexity course

Reading References:

  1. https://www3.ntu.edu.sg/home/ehchua/programming/howto/Regexe.html
    https://cs.lmu.edu/~ray/notes/regex/
  2. Lesson 2 PDF file shared here
  3. Chapter 3 Sections 3.1 and 3.3 of the reference textbook

Lecture 3: Direct RE to DFA Construction Part 1

               Syntax tree for an augmented regular expression

               Computation of FIRSTPOS, FOLLOWPOS, and NULLABLE

Reading References:

  1. Subsections 3.9.1 to 3.9.4 of Chapter 3 of the reference textbook

Lecture 4:  Direct RE to DFA Construction Part 2

               RE to direct DFA construction algorithm

               Lexical Errors

Reading References:

  1. Sub section 3.9.5 and 3.1.4 of Chapter 3 of the reference textbook

Lecture 5: Introduction to Syntax Analysis

The role of a parser

Context Free Grammars

Parse Trees and Derivations

Grammar Ambiguity and Mitigation Techniques

Verifying the Language Generated by a grammar

Take-home assignment-2: an assessment of student’s knowledge of context-free grammar, parse trees, and derivations from Automata and Complexity course

Reading References:

  1. Chapter 4 Section 4.1 and subsection 4.2.1 to 4.2.5 of the reference textbook
  2. Lesson 5 PDF file shared here

Lecture 6: Introduction to Bottom-up Parsing

               Concept of Reductions

               Stack simulation example of Bottom-up Parsing

               Concept of Shift-reduce Parsing

Handles and Handle Pruning

Reading References:

  1. Chapter 4 Section 4.5 of the reference textbook

Lecture 7: Introduction to Simple LR Parsing

LR(0) Items

Closure of a LR(0) Item Set

LR(0) Automaton Construction

Reading References:

  1. Chapter 4 subsection 4.6.1 and 4.6.2 of the reference textbook

Lecture 8: Construction of SLR Parsing Table

FIRST and FOLLOW computation

Generation of SLR Parsing Table from LR(0) automaton and FOLLOW set of non-terminals

Reading References:

  1. Chapter 4 Subsection 4.4.2 and 4.6.4 of the reference textbook
  2. Chapter 4 Subsection 4.6.3 (Only the structure of LR parsing table) of the reference textbook

Lecture 9: SLR Parsing Algorithm

               Behavior of a SLR Parser

               Example of SLR Parsing

               Shift-reduce/Reduce-reduce Conflicts and Other Errors in Bottom-up Parsing

Reading References:

  1. Chapter 4 Subsection 4.6.3 and 4.8.3 of the reference textbook

Lecture 10: Introduction to Syntax-directed Translation

               The logic of syntax directed translation

               Inherited and Synthesized Attributes

               Evaluation of syntax directed definitions

Reading References:

  1. Lesson 10 PDF file shared here
  2. From start of the Chapter to Example 5.2 in Page 307 of the reference textbook 
  3. From the start of Section 5.4 to Example 5.11 in Page 318 of the reference textbook

 

One class equivalent time is reserved for two quizzes before the Midterm exam. If 12 classes can be taken before the midterm, then the other class should be for reviewing so far materials.    

        

Lecture Schedule for the Final Exam

Lecture 11: Dependency Graphs and SDD Types

               Dependency Graphs

               S-attributed Definitions

               L-attributed Definitions

Reading References:

  1. Section 5.2 from Chapter 5 of the reference text book

Lecture 12: Symbol Table

               Importance of Symbol Tables

               Scopes in Program and Nesting of Symbol Tables

               Important attributes of variables and functions

Reading References:

  1. Lesson 12 Slides shared here that are prepared by Professor Rich Maclin of the University of Minnesota Duluth
  2. https://pages.cs.wisc.edu/~fischer/cs536.s08/course.hold/html/NOTES/6.SYMBOL-TABLES.html

Lecture 13: Type Grammar and Attributes of a Type

               Type Expression Grammar

               Attributes of an Array Type

               Grammar for a sequence of variable declarations

               Grammar and attributes of Record Types

Reading References:

  1. Section 5.3.2 of Chapter 5 and Section 6.3 of Chapter 6 of the reference textbook

Lecture 14: Type Information Processing During Bottom-up Parsing

               SDT for Array Type Calculation

               SDT for variable widths and offsets calculation in a sequence of variable declarations

Reading References:

  1. Same as Lecture 13 

Lecture 15: Introduction to Intermediate Code Generation 

               Importance of three address codes as Intermediate Representation

               Features of three address codes

               Quadruples

               Triples

Reading References:

  1. Chapter 6 from Introduction up to Section 6.2 (Inclusive) of the reference textbook

Lecture 16: Array Access Logic and SDT for Array Accesses

               Addressing an array element

               Translation of Array References

Reading References:

  1. Chapter 6 Section 6.4 of the reference textbook         

Lecture 17-18: Handling Flow-of-Control Statements

               Grammar for branching and loops

               SDT for translating if-else and while loops

Reading References:

  1. Chapter 6 Section 6.6 of the reference textbook

Lecture 19:  Handling Object Oriented Language Features during Compilation

Handling class object’s field access

Translation of class methods

The logic of dynamic dispatch

Reading References:

  1. Lesson 19 PDF file shared here

Two class equivalent time is reserved for the two quizzes before the Final exam and for reviewing materials discussed after the midterm.