San Jose State University : Site Name


Main Content

Working in Mars Mission Control, JPL

Ronald Mak

Department of Computer Science
Fall Semester 2015

Office hours: MW: 3:00-4:00 PM
Office location: MacQuarrie Hall, room 413
Mission Control, Jet Propulsion Laboratory (JPL)
NASA Mars Exploration Rover Mission

CS 153/SE 153: Concepts of Compiler Design

MW 9:00-10:15 AM, DH 450


# Date Due Assignment
1 Aug 24 Sept 2 Write a Pascal program
Input file: widgets.csv


Date Content
Aug 25 Slides: Goals; compiler as translator; definitions; overview; conceptual designs; parser; scanner; token; front end; intermediate tier; backend; intermediate code; symbol table; code generator; compiler project; grading
Aug 26 Slides: Interpreters; compiler vs. interpreter; key steps for success; Java packages; class relationships; abstract parser and scanner classes; token and source classes; currentChar() vs. nextChar(); messages;

Sample Pascal programs:
newton.pas  newton.j (Jasmin assembly language object program)
hilbert.pas  hilbert2.pas
wolfisland.pas (Wolf Island input data)
Aug 31 Slides: Initial Pascal-specific parser and scanner; token class; factory classes; initial back end classes; first end-to-end test Pascal tokens; Pascal token classes; syntax diagrams; how to scan for tokens; basic scanning algorithm


First goal: You'll learn the concepts of writing compilers and interpreters for high-level programming languages. You'll write your compilers and interpreters in Java.

In the first half of the course, you'll learn about the front end of a compiler or interpreter: the scanner and the parser; and its middle tier: symbol tables and intermediate code (parse trees). You'll also learn how an interpreter executes source programs in its back end. You'll understand and modify the Java code of a working interpreter. The interpreter will execute source programs written in the Pascal programming language.

In the second half of the course, you'll write your own compiler using JavaCC, the Java compiler-compiler. Your compiler will translate programs written in the high-level language of your choice — or perhaps in a language that you invent — first to Jasmin assembly language and then to .class files that will execute directly on the Java Virtual Machine (JVM).

Compilers and interpreters are complex programs, and writing them successfully is hard work. To tackle the complexity, we'll take a strong software engineering approach in this course. We'll use design patterns, Unified Modeling Language (UML) diagrams, XML, and other modern object-oriented design practices to make the code understandable and manageable.

Second goal: You'll learn critical job skills that employers look for in new college hires:


CS 47 or
CMPE 102
Introduction to Computer Organization
Fundamentals of Embedded Software
grade C- or better
CS 146 Data Structures and Algorithms grade C- or better
CS 154 Formal Languages and Computability grade C- or better
  Department policy is to enforce  
  all course prerequisites strictly,  
  especially for a deep course.  

Required books

Writing Compilers and Interpreters, 3rd edition
Ronald Mak
Wiley Publishing, Inc., 2009
ISBN: 978-0-470-17707-5
Source files from each chapter
Generating Parsers with JavaCC, 2nd edition (PDF)
Tom Copeland
Centennial Books, 2009
ISBN: 0-9762214-3-8

Recommended books

Programming for the Java Virtual Machine
Joshua Engel
Addison-Wesley Professional
ISBN: 0201309726
The Essentials of Pascal I
Gary W. Wester
Research and Education Association
ISBN: 0-87891-694-6
The Essentials of Pascal II
Gary W. Wester
Research and Education Association
ISBN: 0-87891-718-7

Online Pascal tutorials

Learn Pascal  Looks good, although it doesn't appear to cover set types.
Pascal Programming  Ignore Lesson 3. Also doesn't cover set types.
Pascal - Sets  A tutorial on Pascal set types.