| Lecture |
Date |
Subject and Slides |
Readings |
| #1 |
Mon, Sep.14 |
Course Introduction
Course Info(
6in1),
Introduction(
6in1) |
Book Chapter 1 |
#2 #3 #4 |
Wed, Sep.16 Mon, Sep.21 Wed, Sep.23 |
Lexical analysis
(6in1)
Lexer and tokens
Specification of tokens:regular expressions and definitions)
Recognition of tokens: transition diagrams
Finite automata: NFA→DFA: subset construction (ε-closure),
minimize the number of states of a DFA
Regular expression → NFA
A lexical analyzer generator: Flex
Book Chapter 2
ANTLR(slides)
Flex
|
|
#4 #5 #6 #7 #8 #9
|
Wed, Sep.23 Sun, Sep.27
Mon, Sep.28 Wed, Sep.30
Mon, Oct.12 Wed, Oct.14
|
Syntax analysis
(6in1)
Context-free grammars: (terminals, nonterminals, a start symbol, productions), derivations, parse trees, ambiguity
Writing a grammar: lexical vs. syntactic analysis,
verifying the language generated by a grammar, eliminating ambiguity,
eliminating left recursion, left factoring, non-context-free lang. constructs,
Top-down parsing: recursive-descent parsing,
LL(1),LL(*) First(α), Follow(A), parsing table, nonrecursive predictive parsing, error recovery
Bottom-up parsing: handle, shift-reduce parsing, shift/reduce or reduce/reduce conflicts
LR parsing: viable prefix, configuration, action[s, a]: shift | reduce | accept | error, goto[s, A]->s
Top-down parsing vs. Shift-reduce parsing vs. LR parsing
Constructing LR parsing tables: SLR(1), LR(1), LALR(1)
Using ambiguous grammars: precedence and associativity, error recovery
Parser generator: Yacc, ANTLR
|
Book §3.1~3.7
ANTLR
Bison
|
| #TA1 |
Tue, Oct 20 19:30- |
TA's class: homework, practice |
|
|
#10 #11 #12 |
Mon, Oct 19 Wed, Oct 21 Mon, Oct 26 |
Syntax-directed translation
(6in1)
Syntax-directed definitions: synthesis and inherited attributes,
dependence graph, ordering the evaluation of attributes
Syntax tree and its construction
S-attributed definitions and L-attributed definitions
Top-down translation
Bottom-up evaluation
|
Book §4.1~4.4;
ANTLR
Bison
|
#13 #14 #15 #16 |
Wed, Oct 28 Mon, Nov 2 Wed, Nov 4 Mon, Nov 9 |
Type checking
(6in1)
The functionality of type: trapped/untrapped/forbidden error;
well-behaved program, safe language;
typed language, type system(typing rule), type checking, well-typed program
Formalization of type systems:
typing assertion, typing rules, type inference/checking
Specification of a simple type checker
Polymorphic functions: type variables, substitution, unify
Equivalence between type expressions:
structural equivalence, name equivalence
Function/operator overloading
|
Book Chapter 5;
|
| MidEx |
Thu, Nov 23 |
Midterm Exam (1.5h): Ch1~Ch5; 14:00-15:35, 3C203 |
|
|
#16 #17 #18 #19 |
Mon, Nov 9 Wed, Nov 11 Mon, Nov 16 Wed, Nov 18 |
Intermediate Representation and Generation
(6in1)
DotNet Intermediate Representation and Generation
(6in1)
Compiler for Machine Learning
(6in1)
Book Chapter 7, 8.3;
LLVM IR,
LLVM Programmer’s Manual and
LLVM Tutorial
|
|
| #TA2 |
Sat, Nov. 19 |
TA's class:homework, project |
|