Upload
francis-hardy
View
215
Download
1
Embed Size (px)
Citation preview
Course Overview for Compilers
J. H. WangSep. 14, 2015
Compilers, Fall 2015 CSIE, NTUT 2
Instructor and TA
• Instructor– J. H. Wang (王正豪 )– Associate Professor, CSIE, NTUT– Office: R1534, Technology Building, NTUT– E-mail: [email protected]– Tel: (02) 27712171 ext. 4238– Office Hours: 9:10-12:00 on Wednesdays and
Thursdays
• TA– (TBD) (@ R1424, WIRL Lab.)
Compilers, Fall 2015 CSIE, NTUT 3
Course Description• Time: 1:10-3:00pm, Tue., 2:10-3:00pm, Wed.• Classroom: R527, Sixth Teaching Building• Textbook:
– Charles N. Fischer, Ron K. Cytron, and Richard J. LeBlanc Jr., Crafting a Compiler, Global Edition, Pearson Education, Inc., 2009. (開發圖書 )
• http://www.cs.wustl.edu/~cytron/cacweb/
• References: – Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D.
Ullman, Compilers: Principles, Techniques, and Tools, 2nd ed., Addison-Wesley, 2007. (台北圖書 ) (a.k.a ‘The Dragon Book’)
• http://dragonbook.stanford.edu/– Crafting a Compiler with C, by Charles N. Fischer and
Richard J. LeBlanc Jr., Addison-Wesley, 1991.– Engineering a Compiler, 2nd ed., by Keith D. Cooper and
Linda Torczon, Morgan Kaufmann, 2011
Compilers, Fall 2015 CSIE, NTUT 4
Intended Audience
• An introductory course of compilers for undergraduates – For juniors & seniors
• Prerequisite – Basic knowledge of data structures and
discrete mathematics – Programming experience is *required*
for completing programming exercises and projects
Compilers, Fall 2015 CSIE, NTUT 5
Additional References
• More information– http://en.wikipedia.org/wiki/Compiler
• Course Web page– http://www.ntut.edu.tw/~jhwang/
Compiler/
Compilers, Fall 2015 CSIE, NTUT 6
Teaching
• Lectures: mostly in slides, partly on the blackboard
• Homework assignments: about 3 assignments
• Programming exercises: about 2 exercises– Assignments should be turned in within two
weeks• Exams: 1 midterm exam (no final exam)• Projects: 1 term project
Compilers, Fall 2015 CSIE, NTUT 7
Grading Policy
• Homework assignments and programming exercises: ~40%
• Mid-term exam: ~30%• Term project: ~30%
– Including proposal, presentation, and final report
Compilers, Fall 2015 CSIE, NTUT 8
Programming Exercises and Final Project
• At least two programming exercises – Team-based (at most 2 students per team)– Writing your own code or reusing existing open
source code would be fine– Topics: (more on this later…)
• One final project– Either team-based (at most 4 students per
team)– Or compiler-related academic paper
presentation would be another possible option• But, your should do it on your own (only 1 person),
NOT team-based– A proposal is needed one week after midterm
(Nov. 23, 2015)• Introduction, methods used, experiment designs
Compilers, Fall 2015 CSIE, NTUT 9
Major Topics
• Lexical Analysis: scanning• Syntax Analysis: parsing• Code Generation• Optimization
Compilers, Fall 2015 CSIE, NTUT 10
Organization of the Textbook
• I. Basic Part: (Chap. 1-9 will mostly be covered)– Course Overview (1 wk)– Design of a Simple Compiler (1 wk)– Theory and Practice of Scanning (2 wks)– Formal Grammars and Parsing (2 wks)– Top-Down Parsing (2 wks)– Bottom-Up Parsing (3 wks)– Syntax-Directed Compilation (2 wks)– Declaration Processing and Symbol Tables (2 wks)– Semantic Analysis (2 wks)
• II. Advanced Part: (will be skipped)– Intermediate Representations– Code Synthesis for Virtual Machines– Runtime Support– Target Code Generation– Program Analysis and Optimization
Compilers, Fall 2015 CSIE, NTUT 11
Tentative Schedule
• Before midterm– Chap. 1, Overview (1 wk)– Chap. 2, Design of a Simple Compiler (1 wk)– Chap. 3, Theory and Practice of Scanning(2 wks)– Chap. 4, Formal Grammars and Parsing (2 wks)– Chap. 5, Top-Down Parsing (2 wks)
• Before term project– Chap. 6, Bottom-Up Parsing (3 wks)– Chap. 7, Syntax-Directed Compilation (2 wks)– Chap. 8, Declaration Processing and Symbol Tables (2
wks)– Chap. 9, Semantic Analysis (2 wks)– Term Project Presentation (2-3 wks)
Compilers, Fall 2015 CSIE, NTUT 12
Programming Exercises
• Lexical analyzer– Using scanner generator such as lex,
flex
• Parser– Using parser generator such as yacc,
bison
• (Details to be announced on the homepage…)
Compilers, Fall 2015 CSIE, NTUT 13
Possible Topics for Term Project
• Design and implement a new language or syntax (for programming, human languages, for describing elements in game, or any other purposes)– Lexical analysis– Syntax analysis– Code generation– Optional: optimization
Compilers, Fall 2015 CSIE, NTUT 14
Why do we Learn Compilers?
• Parsing and converting documents in different formats (HTML, XML, JSON)
• Parsing network protocols and answering requests in servers
• Parsing SQL query results from databases and generating reports
• Printing or previewing PostScript or PDF files in printers
• Parsing e-mail contents and filtering e-mail spam• Converting hardware specification description
into electric circuit layouts• Designing new computer architectures• …
Compilers, Fall 2015 CSIE, NTUT 15
Thanks for Your Attention!
• Any question or comment?