Compiler Design

CSCI 412, Section 01
Spring Semester 2018



John I. Moore, Jr. Phone:  843-953-7883
Office:  Thompson Hall 209       E-mail:


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: CSCI 223 and CSCI 305


Learning Outcomes

Upon successful completion of this course, a student will be able to



John I. Moore, Jr., Introduction to Compiler Design: An Object-Oriented Approach Using Java, Draft Edition, 2018.

Also:  Course Notes and Handouts


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 final 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

Monday-Wednesday-Friday, 9:00-9:50 a.m., Thompson Hall 216.


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


Miscellaneous Grading Policies

  1. Students are required to work individually on all work done outside of class that will be turned in for a grade. Assistance from anyone other than the instructor or another member of the Computer Science faculty is not permitted.
  2. The course project is divided into several programming assignments, and each programming assignment is due one week after it is assigned unless noted otherwise by the instructor. A late project will have its grade lowered by one letter, and projects more than one week late might not be accepted, based on the discretion of the instructor. The final course project must be demonstrated during the final exam period. No project will be accepted after the final exam period unless explicitly approved by the instructor.
  3. While style, clarity, and enhancements are important, project grades will be based primarily on correctness of programming logic. It is usually better to turn a correct program in late than to turn it in on time with logic errors. Also, you should never turn in a program that fails to compile or run.
  4. Unless otherwise noted, daily quizzes will be based directly on the material covered in the previous day’s course notes and/or reading assignment.
  5. Class attendance and participation can influence borderline grades.
  6. 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.
  7. Incomplete grades are given only in unusual circumstances. Consult the college catalog for policy on incomplete work.


Office Hours

Monday 10:00-11:00 a.m., 1:00-3:30 p.m.
Wednesday 10:00-11:00 a.m., 1:00-3:30 p.m.
Friday 10:00-11:00 a.m.

Other times by appointment


Important Dates

Jan. 15 Martin Luther King, Jr. Holiday (no classes)
Feb. 16 Test #1 (Chapters 1-7)
Mar. 12-16 Spring Break (Work on project during break!)
Mar. 23 Leadership Symposium (no classes)
Mar. 27 Last day to withdraw with a grade of “W”
Apr. 11 Test #2 (Chapters 8-13)
Apr. 26 (Thursday) Final Exam/Project Demonstrations 8:00-11:00 a.m.



  1. Do not miss an assigned test or the final exam without a valid excuse! Missing an assigned test or the final exam without a valid excuse may result in a grade of zero for that test or exam. 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. Personal conversations are disturbing to other students and to the instructor. Please be courteous and respect the rights of others.
  6. Cell phones must be kept out of site and set to a silent or vibrate mode during class.
  7. You should respect the property of your college. No eating, drinking (other than water), smoking, dipping, chewing tobacco, writing or carving on the desks, vandalism, etc. in the classrooms.


Daily Schedule

Dates Topics Covered
Jan. 10 Course Overview; Overview of Compilers and Language Translation
Jan. 12 Overview of Compilers and Language Translation
Jan. 15 Martin Luther King, Jr. Holiday (no classes)
Jan. 17 Structure of Compilers
Jan. 19 Context-Free Grammars
Jan. 22 Context-Free Grammars
Jan. 24 Definition of CPRL
Jan. 26 Project Discussions
Jan. 29 Lexical Analysis (Scanning)
Jan. 31 Lexical Analysis (Scanning)
Feb. 2 Syntax Analysis (Recursive Descent Parsing)
Feb. 5 Syntax Analysis (Recursive Descent Parsing)
Feb. 7 Syntax Analysis (Recursive Descent Parsing)
Feb. 9 Syntax Analysis (Recursive Descent Parsing)
Feb. 12 Error Handling/Recovery
Feb. 14 Project Discussions/Review
Feb. 16 Test #1 (Chapters 1-7)
Feb. 19 Abstract Syntax Trees
Feb. 21 Abstract Syntax Trees
Feb. 23 Abstract Syntax Trees
Feb. 26 Abstract Syntax Trees
Feb. 28 Project Discussions
Mar. 2 Constraint Analysis
Mar. 5 Constraint Analysis
Mar. 7 Project Discussions
Mar. 9 The CPRL Virtual Machine
Mar. 12-16 Spring Break (Work on project during break!)
Mar. 19 Code Generation
Mar. 21 Code Generation
Mar. 23 Leadership Symposium (no classes)
Mar. 26 Code Generation
Mar. 28 Project Discussions
Mar. 30 Optimization
Apr. 2 Subprograms: Procedures and Functions
Apr. 4 Subprograms: Procedures and Functions
Apr. 6 Subprograms: Procedures and Functions
Apr. 9 Project Discussions/Review
Apr. 11 Test #2 (Chapters 8-13)
Apr. 13 Arrays
Apr. 16 Arrays
Apr. 18 Arrays
Apr. 20 Project Discussions
Apr. 23 Project Discussions
Apr. 26 (Thursday) Final Exam/Project Demonstrations 8:00-11:00 a.m.