Compiler (編譯器)
- Course Name: Compiler
- Time: Tuesday, 08:10-11:00
- Credit: 3
- Classroom: TC-208 (ext. 94334492)
- Instructor: Dr. Quincy Wu
- TAs:
- Students: 10
- LINE Group for discussion: NCNU.Course.Compiler
- Textbook:
- John Levine,
Flex
& Bison, O'Reilly Media, Inc., August 2009.
(292 pages)
- Reference books:
- Keith Cooper and Linda Torczon,
"Engineering
A Compiler", Second Edition, 2011.
ISBN:978-0-12-088478-0
- Leland L. Beck,
"Chapter 5 Compilers" in
"
System Software: An Introduction to Systems Programming",
3rd Edition. ISBN:0-321-21177-4
- Torben Mogensen,
Basics of Compiler
Design,
DIKU, University of Copenhagen.
- Evaluation:
- Participation (10%)
- Exercise (20%)
- Midterm Exam (20%)
- Oral Presentation (optional) (10%)
- Final Project (20%)
- Written Report (20%)
- Agenda:
- 2/20 Introduction
- 2/27 Using Flex (1)
- 3/5 Using Flex (2)
- 3/12 Using Bison (1)
- 3/19 Using Bison (2)
- 3/26 Midterm Exam
- 4/2 Spring Vacation
- 4/9 Proposal Review
- 4/16 SQL Syntax (1)
- 4/23 SQL Syntax (2)
- 4/30 SQL Syntax (3)
- 5/7 Parsing SQL (1)
- 5/14 Parsing SQL (2)
- 5/21 Google BigQuery
language
- 5/28 Final Project Presentation
- 6/4 Report Review
- Outline:
- Characters in an Input Line
- Create
Mail Filters
- Writing C Programs on
a FreeBSD server
- How to submit your
homework?
- [YouTube] What Is A
Compiler
- [CPL01] Integer Multiplier
- [CPL02] Hexadecimal Multiplier
- String Handling
- Using UTF-8 as the
internal representation for strings in C and C++
- How
to print characters in hexadecimal in C
- [CPL03] UTF-8 Encoding
- C++
String Stream
- [CPL04] sum_str() in C++
-
[CPL05] sum_str() in C
- Parsing - Understanding Contents in a Line
- [CPL06] Parsing A
Configuration File with Fixed-Format Lines
- [CPL07] White Spaces and Larger Values
- [CPL08] Longer Variable Names
- Regular Expressions
- [YouTube] UNIX Shell Regular Expressions and the
sed and grep commands
- [YouTube]
C++
Regular Expression Library
-
Regular Expressions in Grep Command with 10 Examples
-
Regular expressions library
(cppreference.com)
-
[EX04] Word Count
-
[CPL09]
Delete Spaces
-
[CPL10]
White Spaces
- [CPL11] Validate Email Addresses
- [CPL12] Regular Expression (1)
- [CPL13] Regular Expression (2)
- [CPL14] Regular Expression (3)
- [CPL15] Regular Expression (4)
- Finite State Automata
- [CPL17] Finite Automata
- Nondterministic Finite Automata
- C++ STL Set
- [CPL18] Nondeterministic Finite
Automata
- [CPL19] Nondeterministic Finite
Automata with epsilon-Transition (NFA-e)
- 4/6 Midterm Exam
- Regular Expression to NFA: Thompson's Construction
- NFA to DFA: The Subset Construction
- [CPL20] The Subset Construction
- DFA to Minimal DFA: Hopcroft's Algorithm
- 5種能力,打造競爭實力
- [CPL21] Hopcroft's Algorithm
- [HackingOff]
Regular Expression to NFA
(This site implements Thompson Construction and Subset
Construction, but not Hopcroft's Algorithm.)
- Implementing Scanners
- Context-Free Grammar
- [YouTube] Sheep
Baa
-
C++ BNF Grammar
- [CPL22L] [CPL22R] Context-Free Grammar
- Top-Down Parsing
- Table-Driven LL(1) Parsers
- Removal of Left Recursion
- [CPL24] Depth-First Search (DFS)
with Backtracking
- Left Factoring (P.107)
- [CPL25] Compute FIRST(),
FOLLOW()
- [CPL26] Compute
FIRST+().
- [CPL27] LL(1) Table
Construction
- [CPL28] LL(1) Parser
-
CFG to FIRST() and FOLLOW()
- Use "->" to denote "derives".
- Separate symbols by spaces.
- Bottom-Up Parsing
- Building LR(1) Tables
- 6/22 Final Exam,
Seats
- 教育目標
- 配合國家經濟發展,培養符合資訊產業需求的工程技術人才
- 配合國家科技發展,培養具備前瞻資訊科技研發潛能的人才
- 核心能力
- 具備程式設計基礎知識並應用於設計及實作資訊軟體的能力
- 具備使用英文閱讀資訊領域技術文件的能力
Exercises
- Identify symmetric strings
- Verify ID Numbers
- Verify C++ Variable Names
- 1-10,14-24,26-47,49-53
- Verify IPv4 addresses
- Verify IPv6 addresses
- Verify Email addresses
- Verify URLs
- Matrix operation
- Inner Product A.B
- See MATLAB
-
The m4 Macro Package, Linux Journal, April 2002.
- Macro Magic: m4, Part
One, Linux Magazine, February 2005.
-
Exploiting the m4 Macro Language, Department of Computing
Science and Mathematics
University of Stirling.
- Software
Similarity Tester by Dick Grune.
Other Resources:
TODO
- EX16
- EX36
- a longer sentence for EX16L
- EX37
- Read Compiler Chapter 5
- Jeffery EX12 test cases
- Jeffery EX13 test cases
- C++ STL
Set for Compiler class. std::set::find(), insert(),
empty(), count()
- 600 會造成 judge 讀不到檔案, Syntax Error,
然後就一直卡在那兒,沒有任何回應。 604 也不可,一定要 644. (640 呢?)
- JFLAP - software for
experimenting with finite automata, pusd-down automata.
Network Header Steganography
- Term Project
-
Libpcap File Format
- pylibpcap
-
Wireshark Development: Chapter 9 Packet Dissection