Slides and Weekly References for 160
I will update this site periodically
based on the pace of class presentation and the feedback from you.
If you are not able to access some reference listed below, please let me know.
- Week 1: Overview of compilers and lexical analysis
Slides
Read: Compiler overview (Chapters 1 and 2);
Regular languages; tokens; lexemes; patterns (Chapter 3.1);
specifications of tokens; regular expressions (Chapter 3.3); recognizing tokens (Chapter 3.4).
- Week 2: Lexical analyzer generators. Introduction to syntax analysis
Slides:
Read:
- Lexical analyzer generators (Chapter 3.8).
- Lexical analyzer JLex. Read the JLex user
manual.
- Role of a parser (Chapter 4.1);
context free grammars; derivations; sentential forms; left-most, right-most derivations;
parse trees; ambiguity (Chapter 4.2).
Ambiguous grammars; precedence; associativity; dangling else problem; eliminating
ambiguity (Chapter 4.3);
- Week 2/3: Top-down parsing
Slides:
Read:
-
Top-down vs. bottom-up parsing; top-down parsing; recursive descent parsing;
predictive parsing (Chapter 2.4, Chapter 4.4);
immediate left-recursion elimination; left factoring (Chapter 4.3)
- Stack-based predictive parsing; parse tables;
table-driven predictive parsing algorithm (LL parsing algorithm);
FIRST sets (Chapter 4.4);
FOLLOW sets; LL(1), LL(k) grammars; constructing LL(1), LL(k) parse tables (Chapter 4.4);
- Week 3/4: Bottom-up LR Parsing. Parser Generators
Slides:
Read:
-
- Bottom-up parsing; handles; shift-reduce parsers; stack-based shift-reduce
parsing; Conflicts during shift-reduce parsing (Chapter 4.5).
Table-driven shift-reduce parsing algorithm (LR parsing algorithm) (Chapter 4.7, first section until page 220).
-
CUP . Read the CUP user manual.
- Error recovery strategies in parsing (Chapter 4.1, page 161-165); error recovery in LL parsing
(Chapter 4.4, page 192-194);
error recovery in LR parsing (Chapter 4.8. Page 254-257).
Error recover in Yacc (page 264-266).
- Week 5: Syntax-directed translation and type checking
Slides:
Read:
-
Syntax-directed definitions; attribute grammars;
synthesized and inherited attributes; dependency graphs; evaluation order; topological sort
(Chapter 5.1); constructing syntax trees; constructing syntax trees for expressions using
syntax-directed definitions (Chapter 5.2);
Bottom-up evaluation of S-attributed definitions (Chapter 5.3);
- Type systems; type expressions; static vs. dynamic type
checking; type expressions; basic types; type constructors; type graphs (Chapters 6.1 and 6.2);
equivalence of type expressions; structural vs. name equivalence (Chapter 6.3);
type conversions (Chapter 6.4).
- Week 6: Symbol tables. Runtime environments
Slides:
Read:
- Symbol tables (Chapter 7.6);
Procedures; activation trees; control stack; scope of a declaration (Chapter 7.1).
-
Runtime storage organization; activation records; static data; control stack; heap (Chapter 7.2);
storage-allocation strategies; procedure calls; call-sequence; return-sequence (Chapter 7.3);
access to non-local names; lexical (static) scope with (or without) nested
procedures; access links; displays; procedure parameters; dynamic scope (Chapter 7.4);
parameter passing; call-by-value; call-by-reference; copy-restore; call-by-name (Chapter 7.5).
- Week 7: Intermediate representation and code generation
Slides:
Read:
- Intermediate representations (Chapter 8.1);
intermediate code generation for assignment statements (Chapter 8.3).
- Intermediate code generation for boolean expressions; numerical and flow-of-control representations;
(Chapter 8.4); intermediate code generation for case statements (Chapter 8.5);
- Week 8: Code generation and optimization. Java virtual machine (JVM) and Jasmin
Slides:
Read:
- Allocating storage for variables and procedures (Chapter 8.2); generating code for
addressing array elements (Chapter 8.3). Procedure calls (Chapter 8.7)
- Basic blocks (Chapter 9.4) , DAGs (Chapter 9.8) Code-generator generators (Chapter 9.12);
- JVM/Jasmin documents .
- Week 9: More on code generation and optimization.
Slides:
Read:
- Code generation/optimization from trees (Chapter 9.10).
- Basic dataflow analysis techniques (Chapter 10.5, 10.6).
Acknowledgement:
Most of these slides were originally prepared by Keith D. Cooper at Rice and modified and
extended by Chau-Wen Tseng at UMD.