Learn the fundamental concepts and techniques of compiler design in this comprehensive course covering lexical analysis, parsing, syntax analysis, and code generation. Begin with an introduction to compiler principles and structure before diving into detailed explorations of lexical analysis using regular expressions and finite automata. Master context-free grammars, top-down parsing techniques including recursive-descent and LL(1) parsing, and understand attribute grammars and semantic rules. Explore runtime environments, stack storage allocation, and various intermediate code representations including postfix notation, three-address code, and P-code. Practice your knowledge through multiple final tests while learning how to construct efficient and reliable compilers from scratch.
Overview
Syllabus
- Chapter 1 Introduction of Compiler principles
- 1.1 An Introduction to Compiler Principles
- 1.2 The Structure of the Compiler
- 1.3 The Construction and Composition of a Compiler (I)
- 1.4 The Construction and Composition of a Compiler (II)
- 1.5 Auxiliary Routines and Tools run by the Compiler
- 1.6 Main Data Structures that the Compiler Runs(I)
- 1.7 Main Data Structures that the Compiler Runs(II)
- 1.8 Bootstrapping and Porting(I)
- 1.9 Bootstrapping and Porting(II)
- Chapter 2 Lexical Analysis
- 2.1 Scanning Process
- 2.2 Regular Expressions (I)
- 2.3 Regular Expressions (II)
- 2.4 Regular Expressions (III)
- 2.5 Finite Automata (I)
- 2.6 Finite Automata (II)
- 2.7 Nondeterministic finite automata (I)
- 2.8 Nondeterministic Finite Automata (II)
- 2.9 From Regular Expressions to DFA (I)
- 2.10 From Regular Expressions to DFA (II)
- 2.11 From Regular Expressions to DFA (III)
- 2.12 From Regular Expressions to DFA (IV)
- Chapter 3 Context-Free Grammars
- 3.1 Context-Free Grammars and Parsing
- 3.2 Derivation (I)
- 3.3 Derivation (II)
- 3.4 Parse Trees and Abstract Syntax Trees
- 3.5 Ambiguous Grammars
- 3.6 Extended Notation : EBNF and Syntax Diagrams
- 3.7 Formal Properties of Context-Free Languages
- 3.8 Context-Free Grammars for TINY
- Chapter 4 Top-Down Parsing
- 4.1 The Introduction of Top-Down Parsing
- 4.2 Recursive-Descent Analysis (I)
- 4.3 Recursive-Descent Analysis (II)
- 4.4 Error-Recovery in Top-Down Analysis
- 4.5 LL(1) Parsing (I)
- 4.6 LL(1) Parsing (II)
- 4.7 LL(1) Grammars
- 4.8 First sets
- 4.9 Follow sets (I)
- 4.10 Follow Sets (II)
- 4.11 LL(1) Parsing Tables
- 4.12 The Problems in LL(1) Grammar
- 4.13 Elimination of Left Recursion and Left Factoring
- Chapter 5 Syntax Analysis
- 5.1 Extraction of Attribute Grammars and Semantic Rules (I)
- 5.2 Extraction of Attribute Grammar and Semantic Rules (II)
- 5.3 Construction of Dependency Graphs
- 5.4 Synthesized Attributes and Inherited Attributes
- Chapter 6 Runtime Environment
- 6.1 Runtime Environment (I)
- 6.2 Runtime Environment (II)
- 6.3 The Realization of Stack Storage Allocation (I)
- 6.4 The realization of Stack Storage Allocation (II)
- Chapter 7 Intermediate-Code and Code Generation
- 7.1 Intermediate Code (I)
- 7.2 Intermediate Code (II)
- 7.3 Postfix Notation(I)
- 7.4 Postfix Notation(II)
- 7.5 Three-Address Code (I)
- 7.6 Three-Address Code (II)
- 7.7 P Code
- 7.8 Code Generation Techniques
- Final test
- Final test 1
- Final test 2
- Final test 3
Taught by
Liu Gang, Fu Yan, Cao Xue, LI lijie, and Gao Di