CCOM 4087 - Compiler Design - Spring 2022

University of Puerto Rico
Rio Piedras Campus
College of Natural Sciences
Department of Computer Science


Field Value
Name Humberto Ortiz-Zuazaga
Office NCL A-159
Laboratory NCL A-158
Telephone 787-764-0000 x88363
Web page
Office hours online by appointment


3 credits


Introduction to compiling, structure of simple one-step compilers: syntax and lexical analysis, parsing, introduction to type checking, intermediate code generation, introduction to code generation and optimization. Discussion about tools for compilers design (e.g. Lex and Yacc).


  • High Level Programming Languages (CCOM 4029)
  • Computer Architecture (CCOM 4086)
  • Operating Systems (CCOM 4017)


  • Introduction to compiling

  • Simple one pass compilers

  • Lexical analysis

  • Symbol tables

  • Parsing

  • Syntax directed translation

  • Introduction to type checking and run time environment

  • Intermediate code generation

  • Introduction to code generation and code optimization

  • Discussion of tools in compiler design


  1. Understand how the design of a compiler requires most of the knowledge acquired during their study

  2. Develop a firm and enlightened grasp of concepts learned earlier in their study like higher level programming, assemblers, automata theory, and formal languages, languages, languages specifications, data structure and algorithms, operating systems and computer architecture.

  3. Develop an in–depth knowledge of major topics in compiler design.

  4. Develop a fundamental understanding of various stages of compiling.

  5. Apply the ideas, the techniques, and the knowledge acquired for the purpose of other software design

  6. Develop fundamental knowledge of language specifications using context free grammars (CFG).

Course Schedule

Class will meet Tuesday and Thursday from 10:00 to 11:20 AM in NCL A-229.

NOTE: Due to the COVID-19 pandemic, clases have moved online until further notice.

The course will be taught in face to face mode, however given the emergency circumstances related to COVID-19, or other emergency situation that might arise, the course will be switched to distance mode assisted by technology.


Date Topic Reading Assignment
Jan Introduction to OCaml Learn OCaml in Y minutes Warmup
Introduction Lecture 1 depython
Feb Integers compiler Lecture 2
Lexing and Parsing Real World OCaml Parsing parser
"variables" and stacks Lecture 3 prettier
Conditional expressions Lecture 4 otro anf [ifnz] [anfed]
Mar Types Lecture 5 Boolop
Function calls Lecture 6 [print]
Function definitions Lecture 7
Type checking and inference Lecture 11 and Lecture 12
Apr Pairs and the heap Lecture 13
Mutable tuples Lecture 14
Spring break
First class functions Lecture 15
Objects Lecture 16
May Advanced topics

Alternative Teaching Methods

Certification No. 112 (2014-2015) of the Governing Board defines a classroom course as a course in which 75% or more of the hours of instruction require the physical presence of the students and the teacher in the classroom. This means that 25% of a classroom course could be offered without requiring the physical presence of the students and the teacher in the classroom. If necessary, this course will be able to complete up to 25% of the contact hours (11.25 hours) on a non-face-to-face basis by alternative methods such as: videoconferences, instructional modules, discussion forums and others. If so, the calendar/agenda will be modified to include the topics that will be covered by alternative methods.

Instructional strategies

The professor will discuss each topic, students will complete a practical excercise for each compiler technique discussed in class.

Instructional resources

The course will be hosted on the UPRRP Moodle. Register and stay tuned for our polls and forum postings.


The text for the course will be Ben Lerner's Compiler lecture notes.

Students with no functional programming experience will probably need an additional text on OCaml. I can suggest the free textbook by Jason Hickey Introduction to Objective Caml. Or the textbook by Michael R. Clarkson Functional Programming in OCaml.


We will be writing our compiler in the functional programming language Objective Caml. See the website for instructions to download ocaml and opam.


Students work will be evaluated on a 100% basis with the standard curve.

  • Participation in course forums (online, classroom), 33% final grade
  • Homework, 34% final grade
  • Quizzes, 33% final grade


The University of Puerto Rico prohibits discrimination based on sex, sexual orientation, and gender identity in any of its forms, including that of sexual harassment. According to the Institutional Policy Against Sexual Harassment at the University of Puerto Rico, Certification Num. 130, 2014-2015 from the Board of Governors, any student subjected to acts constituting sexual harassment, must tum to the Office of the Student Ombudsperson, the Office of the Dean of Students, and/or the Coordinator of the Office of Compliance with Title IX for an orientation and/or a formal complaint.


The University of Puerto Rico complies with all state and federal laws and regulations related to discrimination, including “The American Disabilities Act” (ADA law) and Law #51 from the Puerto Rico Commonwealth (Estado Libre Asociado de Puerto Rico). Every student has the right to request and receive reasonable accommodation and Vocational Rehabilitation Services (VRS). Those students with special needs that require some type of particular assistance or accommodation shall explicitly communicate it directly to the professor. Students who are receiving VRS services shall communicate it to the professor at the beginning of the semester so that appropriate planning and the necessary equipment may be requested according to the Disabilities Persons Affairs Office (Oficina de Servicios a Estudiantes con Impedimentos –OSEI) from the Students’ Deanship office. Any other student requiring assistance or special accommodation shall also communicate directly with the professor. Reasonable accommodations requests or services DO NOT exempt the student from complying and fulfilling academic and course related requirements and responsibilities.


The University of Puerto Rico promotes the highest standards of academic and scientific integrity. Article 6.2 of the UPR Students General Bylaws (Board of Trustees Certification 13, 2009-2010) states that academic dishonesty includes, but is not limited to: fraudulent actions; obtaining grades or academic degrees by false or fraudulent simulations; copying the whole or part of the academic work of another person; plagiarizing totally or partially the work of another person; copying all or part of another person answers to the questions of an oral or written exam by taking or getting someone else to take the exam on his/her behalf; as well as enabling and facilitating another person to perform the aforementioned behavior. Any of these behaviors will be subject to disciplinary action in accordance with the disciplinary procedure laid down in the UPR Students General Bylaws.

To ensure user data integrity and security, hybrid and distance education courses are offered through the institutional learning management system, which employs secure connection and authentication protocols. The system authenticates the users’ identity with the username and password of their institutional accounts. Users are responsible for keeping their password secure and not sharing with others.


  1. Andrew W. Appel. (1998) Modern Compiler Implementation in ML. Cambridge University Press. ISBN 0-521-60764-7.

  2. Fischer, C. N., Cytron, R. K., & LeBlanc, R. J. (2009). Crafting a compiler. Addison-Wesley Publishing Company. ISBN 0136067050 9780136067054