San Jose State University : Site Name


Main Content

Working in Mars Mission Control, JPL

Ronald Mak

Department of Computer Engineering
Spring Semester 2019

Office hours: TuTh: 3:00-4:00 PM
Office location: ENG 250
Mission Control, Jet Propulsion Laboratory (JPL)
NASA Mars Exploration Rover Mission

CMPE 152: Compiler Design

Section 1 (class):  TuTh  4:30 - 5:20 PM  room BBC 320
Section 2 (lab):  Tu 6:00 - 8:45 PM  room ENG 206
Section 3 (lab):  Th 6:00 - 8:45 PM  room ENG 206


# Date Due Assignment
1 Jan 25 Feb 1 Write Pascal Programs

Sample Pascal program: EmployeeListing.pas
Input file: employees.txt
Output: output.txt
2 Feb 5 Feb 15 C++ Scanner

3 Feb 14 Mar 4 WHEN statement

Input: when.txt    whenerrors.txt


Week Date Content
1 Jan 24 Slides: Goals; course learning outcomes; project teams; grading; postmortem assessment report; overview of the compilation process; compiler as translator; Assignment #1
2 Jan 29 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;
Jan 31 Slides: Initial Pascal-specific parser and scanner; token class; factory classes; initial back end classes; first end-to-end test; Pascal token classes
3 Feb 5 Slides: Basic scanning algorithm; Pascal scanner; Pascal token classes: word, string, number; syntax error handling
Feb 7 Slides: Pascal tokenizer; Assignment #2; symbol table conceptual design; symbol table interfaces; symbol table factory class; symbol table and symbol table stack implementation; Symbol table entries; cross-reference listing; statement syntax diagrams
4 Feb 12 Slides: statement syntax diagrams; parse tree conceptual design; syntax diagrams: Pascal statements and expressions; parse tree: conceptual design, basic operations, implementation, buildingPascal expression syntax; precedence rules; example expression decomposition; parsing expressions; Parsing expressions; printing parse trees; Pascal Syntax Checker I
Feb 14 Slides: Parsing REPEAT and WHILE statements; error synchronization and recovery; Pascal Syntax Checker II; parsing FOR and IF statements; Assignment #3


Dates Activities
Jan 24, 29 Slides: Assignment #1: Write simple Pascal programs
Jan 31, Feb 5 Slides: Install development environment; compile and run Chapter2cpp sources
Feb 7, 12 Slides: Work on Assignment #2: C++ Scanner
Feb 14, 19 Slides: Complete Assignment #2; start Assignment #3: WHEN Statement

Goals of the course

This course will concentrate on practical aspects of compiler construction, programming language design, and engineering a large, complex software application.

This is a challenging course that will demand much of your time and effort throughout the semester.


Department policy is to enforce
all course prerequisites strictly.

CMPE 102 Assembly language programming grade C- or better
CMPE 126 Algorithms and data structure design grade C- or better

Required books

Writing Compilers and Interpreters
Source files

Writing Compilers and Interpreters, 3rd edition
Ronald Mak
Wiley Publishing, Inc., 2009
ISBN: 978-0-470-17707-5
Source files
The Definitive ANTLR 4 Reference, 2nd edition
Terence Parr
Pragmatic Bookshelf, 2012
ISBN: 978-1934356999

Online Pascal tutorials

Pascal Tutorial  looks very good. It has an online Pascal compiler.
Learn Pascal  also looks good, although it doesn't appear to cover set types.

Online Pascal development sites