Compiler Design

CSCI 412, Section 01
Spring Semester 2007

 

Instructor

John I. Moore, Jr. Phone:  843-953-7882
Office:  Thompson Hall 230       E-mail:  john.moore@citadel.edu

 

Course Description

This course explores the basic principles, algorithms, data structures, and tools involved in the design and construction of compilers. Topics include formal grammars, lexical analysis, parsing algorithms, semantic analysis, error recovery, code generation, and optimization. Each student will be required to complete a substantial programming project, the implementation of a compiler for a small programming language.

 

Prerequisite

Formal Prerequisite: CSCI 355

Informal Prerequisite: Strong background in data structures, algorithms, basic software engineering concepts, and both high-level and low-level programming languages. If you have mastered the concepts in both CSCI 305 (Computer Organization and Programming) and CSCI 223 (Data Structures and Algorithms), you should be able to perform well in this course.

 

Learning Outcomes

Upon successful completion of this course, a student will

 

Textbook

David A. Watt and Deryck F. Brown, Programming Language Processors in Java: Compilers and Interpreters, Prentice Hall, 2000.

Also:  Course Notes and Handouts

 

Compiler References

  1. [Aho 2006] Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Compilers: Principles, Techniques, And Tools (Second Edition – a.k.a. Purple Dragon), Addison Wesley, 2006.
     
  2. [Appel 2002] Andrew W. Appel, Modern Compiler Implementation in Java (Second Edition), Cambridge University Press, 2002.
     
  3. [Brinch Hansen 1985] Per Brinch Hansen, Brinch Hansen on Pascal Compilers, Prentice-Hall, 1985.
     
  4. [Elder 1994] John Elder, Compiler Construction: A Recursive Descent Model, Prentice-Hall, 1994.
     
  5. [Mak 1996] Ronald Mak, Writing Compilers and Interpreters: An Applied Approach Using C++ (Second Edition), John Wiley & Sons, 1996.
     
  6. [Wirth 1996] Niklaus Wirth, Compiler Construction, Addison Wesley, 1996. (available online at http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf)

 

Programming Project

This course requires that each student complete a major programming project, the design and implementation of a small compiler. The project will be graded primarily on completeness and correctness, but other factors such as overall design and structure will also affect your project grade. The project must be demonstrated during the time period allocated for the final exam. More details on the grading criteria for the project will be discussed in class as the course progresses.

 

Class Schedule

MWF 9:00-9:50, Thompson Hall 216.

 

Grading

The final grade for the course is based on 5 grades as follows:

 

Miscellaneous Grading Policies

  1. Students are required to work individually or with approved team members on all work done outside of class. Assistance from anyone other than the instructor, a librarian, the writing center staff, or an approved team member is forbidden.
     
  2. Daily quizzes will come directly from the material covered in the previous day's class.
     
  3. Homework will be assigned but not collected; however, daily quizzes will often be based on homework assignments.
     
  4. Class attendance and participation can influence borderline grades.
     
  5. A total of nine absences will result in a course grade of F. With respect to this policy, three lates count as an absence. In addition, if you are late by 15 minutes or more, you will be considered absent.
     
  6. Incomplete grades are given only in unusual circumstances. Consult the catalog for policy on incomplete work.

 

Office Hours

Monday 1:00-2:30 p.m.
Tuesday 1:00-2:30 p.m.
Wednesday  10:00-12:00 a.m.
Thursday 1:00-2:30 p.m.

Other times by appointment

 

Important Dates

Jan. 15 Martin Luther King, Jr. Holiday (no classes)
Feb. 16 Test #1
Mar. 7 Last day to withdraw with a grade of “W”
Mar. 26-30  Spring Break (Work on project during break.)
Apr. 9 Test #2
Apr. 26 Final Exam Period/Project Demonstrations 1:00-4:00 p.m.

 

Expectations

  1. Do not miss the assigned tests without a valid excuse! Missing an assigned test without a valid excuse will result in a grade of zero for that test. The instructor gets to determine whether or not an excuse is valid. In particular, guard duty is not an acceptable excuse for missing an assigned test. When possible, students should notify the instructor in advance if they will be unable to take an assigned test. All make-up tests will be given outside of normal class time. Once a test has been given in class, any subsequent make-up tests may differ significantly.
     
  2. Show up for class on time and prepared. That means that you have read the appropriate sections from the book plus any handouts, and you have worked all assigned homework. If a test has been assigned, you should be prepared to take the test. If you were late to class or absent from the previous class meeting, you are responsible for getting class notes and assignments from another student in the class or from the instructor.
     
  3. If you are late to class, it is possible that you have already been marked absent by the time you arrive. It is your responsibility to notify the instructor after class that you were late rather than absent.
     
  4. Take care of any personal needs outside of class time. Except for emergencies, you should not need to go to the bathroom, get a drink of water, etc. If you need to leave the room at any time while class is in session, you should ask for permission.
     
  5. There should be no personal conversations or moving around during class without explicit permission. These actions are disturbing to other students and to the instructor. Be courteous and respect the rights of others.
     
  6. You should respect the property of your college. No eating, drinking (other than water), smoking, dipping, chewing tobacco, etc. in the classrooms. Also, no writing or carving on the desks, chairs, podium, etc. Any willful vandalism or destruction of Citadel property will be dealt with severely.

 

Daily Schedule

Dates Topics Covered
Jan. 10-12 Overview of Compilers and Language Translation
Jan. 15 Martin Luther King, Jr. Holiday (no classes)
Jan. 17 Structure of Compilers
Jan. 19-22 Context-Free Grammars
Jan. 24 Definition of the Programming Language CPL
Jan. 26-31 Lexical Analysis (Scanning)
Feb. 2-7 Syntax Analysis (Recursive Descent Parsing)
Feb. 9 Error Handling/Recovery
Feb. 12-14 Brief Review of Java and Object-Oriented Programming
Feb. 16 Test #1
Feb. 19-26 Abstract Syntax Trees
Feb. 28-Mar. 5  Constraint Analysis
Mar. 7 The CPL Virtual Machine
Mar. 9-14 Run-Time Organization
Mar. 16-23 Code Generation
Mar. 26-30 Spring Break (Work on project during break.)
Apr. 2-4 Optimization
Apr. 6 CPL/1: Implementing Procedures and Functions
Apr. 9 Test #2
Apr. 11-16 CPL/1: Implementing Procedures and Functions (continued)
Apr. 18-23 Full CPL: Implementing Arrays and Enumerated Types
Apr. 26 Final Exam Period/Project Demonstrations 1:00-4:00 p.m.