|
Click here for photos of our visit to the Computer History Museum! |
| Date | Content |
|---|---|
| Aug 25 |
slides newton.pas |
| Aug 27 |
slides |
| Sept 1 |
slides |
| Sept 3 |
slides |
| Sept 8 |
slides |
| Sept 10 |
slides |
| Sept 15 |
slides |
| Sept 17 |
slides Article: IBM 1401 FORTRAN compiler (63 passes!) |
| Sept 24 |
slides |
| Sept 29 |
slides |
| Oct 1 |
slides |
| Oct 6 |
slides |
| Oct 8 |
slides |
| Oct 13 |
slides |
| Oct 15 |
slides 2008 Midterm |
| Oct 22 |
slides helloworld1.jj helloworld2.jj helloworld3.jj helloworld4.jj helloworld5.jj |
| Oct 27 |
slides 2009 Midterm SimpleDFAScanner.java scannertest.in |
| Oct 29 |
slides |
| Nov 3 |
slides |
| Nov 5 |
slides Pcl |
| Nov 12 |
slides Pcl2 |
| Nov 17 |
slides |
| Nov 19 |
slides |
| # | Date | Assignment | Due |
|---|---|---|---|
| 1 | Aug 25 |
Write a Pascal program.
Input file: employees.txt Suggested solution. |
Sept 1 |
| 2 | Sept 1 |
Write a C scanner.
Input file: testdata.txt |
Sept 10 |
| 3 | Sept 15 |
Parse and execute Pascal set expressions and assignments.
Input file: sets.txt Input file: seterrors.txt Suggested solution. |
Sept 24 |
| 4 | Sept 29 |
Parse label and set declarations and GOTO statements.
Input file: declarations.txt Input file: declerrors.txt |
Oct 9 |
| 5 | Oct 22 |
Generate a C scanner with JavaCC.
Input file: testdata.txt Suggested solution. |
Oct 29 |
| 6 | Oct 29 | Generate a parser with JavaCC. | Nov 6 |
| 7 | Nov 5 | Generate parse trees with JJTree. | Nov 13 |
There are two major goals for this course.
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. The source programs that your interpreter will execute are written in Pascal, a simple but powerful procedure-oriented language. You'll choose your favorite programming language to compile. Your compiler will generate object code for the Java Virtual Machine (JVM), and you'll execute your compiled programs on the JVM running on multiple platforms.
In the first half of the course, you'll learn about the front end of compilers and interpreters: the scanner and the parser; and their middle tier: symbol tables and intermediate code (parse trees). You'll also learn how an interpreter executes source programs in its back end. I'll provide the Java code of a working interpreter for you to understand and modify.
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 — and generate Jasmin assembly language object code. After using the Jasmin assembler, you'll execute your compiled programs on the 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:
Required books
I've just completed the third edition of my book, Writing Compilers and Interpreters: A Software Engineering Approach. Because it won't be out in time for this semester, I'll provide free copies of the book's chapters from my original manuscript as PDF files. Other required books:
|
Programming for the Java Virtual Machine Joshua Engel Addison-Wesley Professional ISBN: 0201309726 |
|
Generating Parsers with JavaCC Tom Copeland Centennial Books http://generatingparserswithjavacc.com/ ISBN: 0-9762214-3-8 |
|
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
| Pascal Programming looks very good. Just stay away from the Turbo Pascal features which were extensions added by Borland. There are some dead navigation links. |
| Learn Pascal also looks good, although it doesn't appear to cover set types, which you'll need for some of your assignments. |
Who am I
I'm currently a Research Staff Member at the IBM Almaden Research Center in San Jose, where I'm helping to develop storage system software for IBM's next multi-petaflops supercomputer. Previously, I was a Senior Scientist at the NASA Ames Research Center, where I designed and led the development of the middleware for an information management system for NASA's Mars Exploration Rover mission. I was also the Enterprise Software Strategist at the Lawrence Livermore National Laboratory for a major laser-based fusion energy project, the National Ignition Facility (NIF).
I've written books on compiler writing, software engineering, and numerical computation. I find designing and developing software such as compilers and enterprise systems to be fun and challenging. So I'm the kind of geek nobody wants to talk to at parties. My one redeeming feature is that I have two cute cats. No, they're not named Yacc and Lex.
| Past courses I've taught at SJSU |
|---|
| Spring 2008: CS 160 Software Engineering |