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

1 Introduction
2 Passes of a Compiler
3 Passes of a Compiler
4 Passes of a Compiler
5 Lexical Analysis
6 Specification of Tokens
7 Recognition of Tokens
8 NFA To DFA
9 DFA State Minimization, Lex
10 Lex, Parsing
11 CFG, Derivations
12 CFG, Ambiguity, Precedence
13 Top-down Parsing
14 Predictive Parsing
15 Recursive Descent Parsing
16 LL Parsing
17 LL Parsing
18 LL Parsing
19 LL Parsing Table Construction, Left Factoring
20 Bottom-up Parsing
21 Shift-Reduce Parsing
22 Shift-Reduce Parsing: Finding Handles
23 LR(1) Parsing
24 LR(1) Parsing
25 LR(1) Parsing
26 LR(1) Canonical Collection of Items
27 LR(1) Parsing Table Construction
28 LR(1) Parsing, Shift-Reduce Conflicts
29 LALR Parsing
30 Parser Generators - YACC
31 Sematic Analysis
32 Attribute Grammars
33 Ad-hoc scheme for attribute grammars
34 Ad-hoc scheme, Intermediate Representation (IR)
35 Intermediate Representation taxonomy
36 Syntax-directed translation: assignment statement
37 Syntax-directed translation: control flow statement
38 Syntax-directed translation: boolean expression
39 Syntax-directed translation: back patching
40 Syntax-directed translation: back patching, type checking
41 Code Generation
42 Code Generation
43 Code Generation: Basic Blocks
44 Code Generation: Register Allocation
45 Code Optimization
46 Assignment on Emerging Trends
47 Pre-Assesment