CS606 : Compiler Construction

Course Overview

Course Synopsis

The course introduces the students to the operation of a modern compiler that translates code in a programming language into machine code. Special emphasis is placed on the actual construction of a compiler by working on a project that builds a compiler for a language that is a subset of C++. Modern compilers operate in three passes. These are front-end, middle end and back end. Given a program written in a programming language, the front end carries out syntax analysis of input program. The middle end performs code optimization so that the eventual executable program will require less memory and will be efficient at runtime. The back end generates actual assembly language code for the target machine. We will study mechanics of the three stages. However, due to the introductory nature of the course, we will spend majority of the time on syntax analysis and code generation. We will touch upon optimization briefly. The course provides a practical opportunity to see how concepts and techniques from various areas of Computer Science come together to build a useful tool.

Course Learning Outcomes

At the end of the course, you should be able to

  • Translate and interpret computer languages,
  • The basic theory of compilers.
  • Evaluate the issues involved in implementing a compiler
  • Better knowledge about how a compiler works
  • Design parsers and compilers for any language

Course Calendar

Course Organization1Handouts1-4
Two-pass Compiler2Handouts5-7
Abstract Syntax Tree3Handouts8-9
Register Allocation4Handouts10-11
Lexical Analysis5Handouts12-14
How to Describe Tokens?6Handouts15-17
Table Encoding of FA7Handouts18-21
NFA? DFA Construction8Handouts22-24
DFA Minimization9Handouts25-27
Running the Scanner10Handouts28-33
Assignment No. 1
Syntactic Analysis11Handouts34-36
Parse Trees12Handouts37-42
Top-Down Parser13Handouts43-46
The LL(1) Property14Handouts47-50
Recursive Descent in C++15Handouts51-56
Recursive Descent in C++16Handouts51-56
LL(1) Table Construction17Handouts57, 61-62
Computing FIRST Sets18Handouts58-60
LL(1) Table Construction19Handouts57, 61-62
Bottom-up Parsing20Handouts63-65
Quiz No. 1
Shift-Reduce: The Stack21Handouts66-67
Mid Term Exams
LR(1) Parsers23Handouts70-71
Canonical Collection24Handouts72-73
The goto Procedure25Handouts74-75
Finite Automation of Items26Handouts76-78
LR Table Construction27Handouts79-83
LR(1) Skeleton Parser28Handouts84-85
Shift/Reduce Conflicts29Handouts86-87
Parser Generators30Handouts88-89
Assignment No. 2
Beyond Syntax31Handouts90-93
Evaluation Methods32Handouts94-95
Quiz No. 2
Implementing Ad-Hoc Scheme33Handouts96
Intermediate Representations34Handouts97-99
IR Taxonomy35Handouts100-102
Assignment Statement36Handouts103
Graded Moderated Discussion Board (GDB)
Representing Linear Codes37Handouts104-106
Three-Address Statement Types38Handouts107-108
Boolean Expressions39Handouts109-113
Implementation of Syntax-directed Translation40Handouts114-116
Quiz No. 3
Flow-of-Control Statements41Handouts117-120
Code Generation42Handouts121-123
Control Flow Graph-CFG43Handouts124-128
Basic Code Generation44Handouts129-132
Global Data-Flow Analysis45Handouts133-137
Final Term Exam
Back to Top