CS 152 - Compiler Design
Winter 2009



ProfessorDr. Iulian Neamtiu
Office hours: TR 9:40 a.m. - 10:40 a.m., Engineering BU2 (ENGR2) room 412
TA'sMarc Soriano
Office hours: MW 9:30 a.m. - 11:00 a.m., ENGR2 room 110
 Marcos Vieira
Office hours: TR 4:30 p.m. - 6:00 p.m, ENGR2 room 363
LecturesTR 8:10 a.m. - 9:30 a.m., Sproul Hall (SPR) room 2339
Lab (section 021) R 12:40 p.m. - 03:30 p.m., ENGR2 room 226
Lab (section 022) F 11:10 a.m. - 02:00 p.m., ENGR2 room 127
GradingProject (35%) + Final exam (35%) + Midterm (25%) + Quizzes (5%)
TextbookCompiler Construction: Principles and Practice by Kenneth C. Louden
MidtermFeb 5
Final examMarch 20 (subject to change)
Prerequisites CS 061 and CS 141 and CS 150
Moodle page

Catalog description: Covers the fundamentals of compiler design, including lexical analysis, parsing, semantic analysis, compile-time memory organization, run-time memory organization, code generation, and compiler portability issues. Laboratory work involves exercises covering various aspects of compilers.


Day Date Topic Reading Slides Notes
Tue Jan 6 Introduction Chapter 1 PDF  
Thu Jan 8 Lexical Analysis Chapter 2 PDF  
Lab Jan 8/9 Project 1 handed out, due 1/28   Lab 1 outline  
Tue Jan 13 Lexical analysis (contd.); Syntax Analysis: Grammars Chapter 3 PDF  
Thu Jan 15 Top Down Parsing Chapter 4 PDF  
Tue Jan 20 Top Down Parsing . .  
Thu Jan 22 Bottom Up Parsing Chapter 5 PDF  
Tue Jan 27 Bottom Up Parsing . .  
Thu Jan 29 Bottom Up Parsing . .  
Lab Jan 29/30 Project 2 handed out, due 2/18   Lab 2 outline  
Tue Feb 3 Review      
Thu Feb 5 Midterm      
Tue Feb 10 Semantic Analysis Chapter 6 PDF  
Thu Feb 12 Semantic Analysis . .  
Tue Feb 17 Code Generation Chapter 8 PDF  
Thu Feb 19 Code Generation . .  
Lab Feb 19/20 Project 3 handed out, due 3/11      
Tue Feb 24 Data types and type checking Section 6.4 PDF  
Tue Feb 26 Runtime Environments Chapter 7 PDF  
Thu Mar 3 Runtime Environments . .  
Tue Mar 5 Compiler Backend/Code Optimization PDF PDF  
Thu Mar 10 Code Optimization/Register Allocation . .  
Thu Mar 12 Review      


  1. Lexical Analyzer (1/8 -- 1/28)
  2. Parser (1/29 -- 2/18)
  3. Code Generator (2/19 -- 3/11)


There will be several unannounced quizzes at the beginning of class. Quizzes are designed to test students' understanding of the material assigned in advance for that class (section or chapter in the textbook) or to reinforce material studied in previous lectures. When computing the student's final score, the lowest quiz score will be dropped.


Optional books:


Attendance and basic etiquette

Students are required to attend, follow, and actively participate in all lectures and discussions. All lectures, discussions, and exams start at the stated time. Avoid being late coming to class, as this is very disruptive. Students are requested to refrain from using electronic devices (laptops, cell phones, music players, etc.) during lectures, exams, and discussions. If, for some compelling reason, you need to be on call, be sure to put your cell phone in silent mode, and excuse yourself from the class if you need to take a call. Analogously, when coming to see the instructor or the TA, please turn your cell phone off.


The students are not allowed to discuss the projects among themselves, or collaborate on projects. The only discussion permitted is with the instructor and the TA. Violations of this policy are considered cheating and will be dealt with as academic dishonesty (see below). Late submissions are not accepted except for justifiable reasons, such as an illness with a doctor's written note.

In class examinations

Exams should test your understanding, not your memorization, of the material. Hence, you can use your textbook and your class notes during in-class exams. However, you must check with the instructor before consulting any additional references. No laptops, iPods, cell phones, pagers, or similar devices can be used during the duration of the exam. You must do at least somewhat well in these in-class exams in order to pass the course.

Academic Integrity

Academic integrity will be strictly enforced. Any violation or suspected violation of academic integrity will be dealt with according to the UCR discipline procedure. An excellent, detailed guide to what constitutes academic dishonesty and the procedure in case of academic integrity violations is available here.

What constitutes academic dishonesty?

In short: acts including but not limited to, cheating, fabrication, plagiarism, unauthorized collaboration, or facilitating any of the above.

What are the penalties and sanctions for academic dishonesty?

In short: if a student is found guilty of academic dishonesty, penalties range from receiving an F for the class and adding a record of violation to the student's file, up to dismissal from the University, depending on the severity of the infraction and the number of prior violations of the integrity code.

Ignorance is not an excuse.

The above information is not designed to threaten or intimidate the student. Rather, it is presented to inform the individual of the consequences. The important thing to remember is that if there is any doubt in one's mind that an act is in violation of academic integrity guidelines, then the prudent response would be not to do the act. It is a simplistic approach, to be sure, but one that will benefit both the student and the university community as a whole.

Lecture notes and labs used in this course are based on material from Rajiv Gupta whose help is gratefully acknowledged.