中正大學課程大綱
資訊工程研究所
課程名稱(中文): 編譯器  開課單位: 資訊工程研究所 
課程名稱(英文): Compilers  課程代碼: 4105605_01 
授課教師: 林迺衛 
學分數: 必/選修: 必修  開科年級: 碩博 
先修科目或
先備能力:
Programming experiences in at least one programming language. 
課程概述: A compiler is a program that automatically translates programs written in a language into programs written in another language. This course introduces the principles and techniques of constructing compilers and introduces the principles and techniques of constructing compiler-generators. This course includes a programming project that uses the compiler-generators Flex and Bison to construct a compiler for a small language in the C programming language. 
學習目標: 1.Understand the applications of compiler technology
2.Understand the principles and techniques of lexical analysis
3.Be able to use the tool Flex to construct lexical analyzers
4.Understand the principles and techniques of syntax analysis
5.Be able to use the tool Bison to construct syntax analyzers
6.Understand the principles and techniques of semantic analysis
7.Be able to use the tool Bison to construct semantic analyzers
8.Understand the principles and techniques of code generation
9.Be able to use the tool Bison to construct code generators
10.Be able to use the simulator SPIM to simulate MIPS assembly code
教科書: A. V. Aho, M. S. Lam, R. Sethi and J. D. Ullman, Compilers: Principles, Techniques, and Tools, Second Edition, Addison-Wesley, 2007.
 



課程大綱 分配時數 核心能力 備註
單元主題 內容綱要 講授 示範 習作 其他
Introduction to compilers  1. Language processors
2. The structure of a compiler
3. Applications of compiler technology 
       A1A2A3A4A5A6A7A8  
Lexical analysis  1. Regular expressions
2. Finite automata
3. The lexical analyzer generator Flex 
     A1A2A3A4A5A6A7A8 project part 1 
Syntax analysis  1. Context-free grammars
2. Top-down parsing
3. Bottom-up parsing
4. The syntax analyzer generator Bison 
11       A1A2A3A4A5A6A7A8 project part 2 
Semantic analysis  1. Syntax-directed definitions
2. Syntax-directed translation schemes
3. Construction of syntax trees
4. Type expressions
5. Type checking

 
     A1A2A3A4A5A6A7A8 Project part 3 
Intermediate code generation  1. Intermediate languages
2. Translation of expressions
3. Translation of statements 
     A1A2A3A4A5A6A7A8 Project part 4 
Code generation  1. Storage organization
2. The simulator SPIM
3. Control flow graphs
4. A simple code generation
5. Peephole optimizations
6. Register allocation
7. Optimal code generation for expressions
8. Dynamic programming code generation 
11         A1A2A3A4A5A6A7A8  
A1.具有資訊工程與科學領域之專業知識。
A2.具有創新思考、問題解決、獨立研究之能力。
A3.具有撰寫中英文專業論文及簡報之能力。
A4.具策劃及執行專題研究之能力。
A5.具有溝通、協調、整合及進行跨領域團隊合作之能力。
A6.具有終身學習與因應資訊科技快速變遷之能力。
A7.認識並遵循學術與工程倫理。
A8.具國際觀及科技前瞻視野 。

教學要點概述:
1. 教材編選:自編教材 教科書作者提供
2. 教學方法:投影片講述 板書講述
3. 評量方法:上課點名 0%, 小考 0%, 作業 20%, 程式實作 20%, 實習報告 0%,
                        專案 0%, 期中考 30%, 期末考 30%, 期末報告 0%, 其它 0%
4. 教學資源:課程網站 教材電子檔供下載 實習網站
5. 教學相關配合事項:

課程目標與教育核心能力相關性          如有未出現的核心能力,請先按『確定』送出資料
請勾選:A1A2A3A4A5A6A7A8
A1 具有資訊工程與科學領域之專業知識。
為何有關:
編譯技術在資訊工程領域應用廣泛,例如使用最廣泛的網際網路瀏覽器、文書編輯器、資料庫搜尋等等都奠基在編譯技術上。本課程透過理論的講說及實務的練習帶領同學深入學習編譯技術中的主要課題:語彙分析、語法分析、語義分析、中間碼產生、及目的碼產生。完成這個課程可以幫助同學具備資訊工程領域中編譯技術的專業知識。
達成指標:
學期成績及格
評量方法:
1. 作業 2. 程式實作 3. 考試
A2 具有創新思考、問題解決、獨立研究之能力。
為何有關:
編譯技術本身是一個說明\"問題解決\"的很好的例子,它包含問題模型的建立及問題模型的應用。問題模型的建立如有限自動機及堆疊有限自動機理論的建立。問題模型的應用如將有限自動機實作為語彙分析器及將堆疊有限自動機實作為語法分析器。甚且利用編譯技術實作任何可以幫助自動化的工具。透過這個例子的說明及一些作業的練習,可以幫助學生培養創新思考、問題解決、及獨立研究的能力。
達成指標:
學期成績及格
評量方法:
1. 作業 2. 程式實作 3. 考試