Compiler

902 39200, Spring 2008
M 234, DTH (DerTian Hall) 103

Instructor: 薛智文 Chih-Wen Hsueh
Contact: cwhsueh@csie.ntu.edu.tw, x322, DTH 322
Office Hours: TH  5 9, or by appointment, DTH 322
TAs:  陳柏年, 涂堂訓, 戴偉堯, 胡萬勳, taC@newslab.csie.ntu.edu.tw, x408, DTH 408
Office Hours: TBA, or by appointment, DTH 408
 
Course Plan (subject to change):
  1. Introduction (ch#1, reading ch1.6 and ch#2 by yourself is expected.)
  2. Lexical analysis (Scanner) (ch#3.1–3.4, 3.6, 3.7, 3.5, 3.8): 
    • regular expressions, finite state automata, LEX
  3. Syntax analysis (Parser) (ch#4.1–4.7): 
    • context-free grammar, top-down parsing, LL(1), bottom-up parsing, SLR, LR(0), LR(1), LALR(1)
  4. Syntax-directed translation (ch#5.1–5.6, 4.8, 4.9): 
    • Syntax-directed translation, using ambiguous grammar, YACC
  5. Symbol tables (ch#2.7, 6.5): 
    • data structures for symbol tables, type checking
  6. Intermediate code generation (ch#6.1–6.4,6.6–6.8): 
    • intermediate code, declarations, ex-pressions, advanced data structure, control flow, procedure/function, other statements
  7. Run time storage organization (ch#7.1–7.4): 
    • stack, access to nolocal data, heap
  8. Optimization (ch#8.4,8.5,8.6,9.1,9.2,8.7):
    • basic blocks, flow graphs, machine-independent optimizations
  9. How to write a compiler
  10. Advanced topics1: 
    • garbage collection (ch#7.5–7.8), parallelism (ch#10, ch#11), ...

Homeworks: 作業遲交每一天扣 10%, 抄襲(被抄襲)均不計分.
Final Project:  抄襲(被抄襲)均不計分.
      Final project: Due: 12:00pm, June 16 (Monday) 2008
      Reference : http://www.iis.sinica.edu.tw/~tshsu/compiler2007
      NOTE: Some percentage of scores will be deducted each day for a late submission.
      Unless I agreed in person,
      projects submitted later than 12:00pm, June 16 (Wednesday) 2008 will not be graded!

Schedule (subject to change):
No. Date Topics Notes
1 Feb 18 Introduction;
2 Feb 25 Scanner (I);
3 March 3 Scanner (II); LEX Announcing HWK#1
4 March 10 Parser: Introduction; Top-down parsing (I)
5 March 17 Top-down parsing (II);  HWK#1 due
6 March 24 Bottom-up parsing (I) Announcing HWK#2
7 March 31 Bottom-up parsing (II) Announcing HWK#3
8 April 7 Bottom-up parsing (III) HWK#2 due
9 April 14 Mid-term exam covering lectures 1–8,
10 April 21 Syntax-directed translation HWK#3 due
11 April 28 YACC and data structures Announcing HWK#4
12 May 5 Intermediate-code generation (I)
13 May 12 Intermediate-code generation (II)
14 May 19 Run-time environments (I) HWK#4 due, Announcing HWK#5
15 May 26 Run-time environments (II)
16 June 2 Optimization
17 June 9 Putting everything together HWK#5 due
18 June 16 Final project due


Prerequisites:

    Assembly language, high-level programming language (C-like language), data structures, and automata.

Textbook:
    "Compilers Principles, Techniques, and Tools," by A.V. Aho, M. S. Lam, R. Sethi, and J.D. Ullman, 2007  (2nd edition) Addison Wesley.

Evaluation:
Reference: