Skip to main content.

Overview

This course introduces the principles behind the construction of compilers, including automata, lexical analysis, syntactic analysis, constructing parser, translation, and code generation.  Various features of programming language will be studied through the eye of the compiler designer.

Objectives

This is a practical compiler construction course that combining both theory and practice together while enforcing good software engineering practice.  After completing this course, students should:

  1. be able to create an emulator to emulate a hypothetical computer.
  2. be able to create an assembler and a disassembler to translate between a program written in the assembley language of the forementioned hypothetical computer and an executable program in the machine language of the hypothetical computer.
  3. be able to create a compiler to translate a subset of high-level programming language to an executable program for the hypothetical computer.

Instruction Approach

In order to be successful in this course

  1. Students are required to read the handout before attending each class session.
  2. Every week, there will be a quiz on the subject we are going to study.  A quiz will help students prepare for the upcoming topics.
  3. The assignments will be assigned before each topic is introduced to encourage the student to prepare for the upcoming lecture.  Moreover, another assignments will be assigned after each topic to reinforce the understanding.
  4. There will be approximately 2-3 programming assignments for each week.  These assignments are designed to stimulate the understanding of the compiler construction concepts while instituting the discipline software engineering practice.
  5. Every week, students will present progress on their semester-long project.  Each project must be an compiler for a high-level programming language.

References

We use serveral books during throughout the course.  The following books are the ones we will frequently refer to.

  1. (PLAI) Shriram Krishnamurthi, Programming Languages: Application and Interpretation, April 26, 2007 version.  The author generously makes the electronic version of the book available for free here.
  2. (CCG) P.D. Terry, Compilers and Compiler Generators: An Introduction with C++, International Thomson, 1997, ISBN 1-85032-298-8.  This book is out-of-print but the author generously made the electronic version of the book available for free here.
  3. (Dragon) Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools, Addison Wesley, 1986, ISBN 0-201-10088-6.  This book is also known as the Dragon book.
  4. (OOCC) Jim Holmes, Object-Oriented Compiler Construction, Prentice Hall, 1995, ISBN 0-13-192071-5.  This is a book using object-oriented approach to construct a compiler.
  5. (RCC) Christopher Fraser and David Hanson, A Retargetable C Compiler: Design and Implementation, AT&T, 1995, ISBN 0-8053-1670-1.  This is a book using literate programming to create a production-quality retargetable C compiler.

Other books that may be useful are those about programming languages.

Course outline

The following schedule is tentative only; it may change depending on the circumstances. 

Week Topics
1 Introduction Compiler
2 Automata, Regular Expression, Regular Grammar
3 Context-Free Languages
4 Top-down parsing
5 Bottom-up parsing
6 Attribute Grammar
7 Generating intermediate code I
8 Midterm
9 Generating intermediate code II
10 Optimization
11 Rudimentary Interpreter
12 Laziness
13 Recursion
14 Memory Management
15 What's next
16 Conclusion
17 Final Exam

Note that the above schedule is tentative by nature; it may change at the instructor's discretion.

Evaluation

The course evaluation will be divided equally between examinations and assignments.  The distribution of each half is shown below.  

Items Weight
Individual Assignments 15%
Group Assignments 15%
Discussion 15%
Game Participation 15%
Midterm Exam 20%
Final Exam 20%

Please make sure that you have carefully read and understand the academic policy.

Note that the above description is only tentative; it may change at the instructor's discretion.