編譯器原理

臺北科技大學 115-1 學期課程,課號 364889。

課程大綱

本課程主要在研討傳統的結構化語言的編譯技術。課程所所涵蓋的內容包括有: - 語句上的分析、語句分析器的製作 - 由上而下的組譯器製作 - 由下而上的組譯器製作 - 語意分析 - 機器碼之產生與暫存器之配置 - 資料流分析的理論與應用 - 程式碼最佳化處理。課程的實施,將以基本編譯技術為主,作深入的介紹。學習所得的觀念與技術,將利用一個實驗性語言編譯器的實作來貫穿。因此,程式規畫實作,將在這個課程中,佔有相當大的比重。 This course discusses issues in the compilation of conventional block-structured languages, as listed below. - lexical analysis, scanner generators; - top-down parsing, LL(1) parsers; - bottom-up parsing SLR, LALR, LR(1) parsers, parser generators; - semantic analysis; - code generation and register allocation, code generator generators; - dataflow analysis: theory and practice; - code optimization. There will be a significant programming component to the course

課程進度

Week 1: Introduction + Intro to OCaml Week 2: x86-64 Assembly Language Week 3: Abstract Syntax, Semantics and Interpreter in OCaml Week 4: TD Interpreter in Mini-Python Week 5: Lexical Analysis Week 6: Parsing: Syntax Analysis 1/2 Week 7: Parsing: Syntax Analysis 2/2 Week 8: Static Typing Week 9: Parameter Passing Week 10: Compiler Correctness Week 11: Compiler of Functional Language Week 12: Compiler of Object-Oriented Language Week 13: TD Code Production Week 14: Optimizing Compiler 1/2 Week 15: Optimizing Compiler 2/2 Week 16: Final Exam Week 17 & 18: GC

評量方式

Assignment: 30% Mid-term: 30% Final Project: 40%

教材

【遵守智慧財產權觀念,請使用正版教科書,不得使用非法影印教科書】 使用外文原文書:否 You may find the corresponding materials to the lectures in the following books. 1. Alfred V. Aho, Monica S. Lam, Ravi Sethi et Jeffrey D. Ullman Modern Compilers: Principles, Techniques, and Tools. 2. Benjamin C. Pierce Types and Programming Languages 3. Randal E. Bryant et David R. O'Hallaron Computer Systems: A Programmer's Perspective Other relevant resources: - Nielson, Nielson, and Hankin. Principles of Program Analysis - Appel. Modern compiler implementation in ML (there are also Java/C versions) - Robert Harper. Practical Foundations for Programming Languages