CS 496 - Compiler Design

Spring 2008

David Hovemeyer
Office / Phone
GH 118 / 717-815-6582
Office Hours
M-F 11-12
Place GH 123
Class Times T/Th 12:30 - 1:45 PM



Course Syllabus

Lecture Notes (I make no guarantees about the correctness or usefulness; caveat emptor)

CS 143 at Stanford University - there is a very nice set of lecture notes here


Java Downloads (you should download JDK 6)

Eclipse IDE (download the latest version)

Ant (needed to build Java code from the command line)

JFlex (a lexical analyzer generator for Java)

CUP (a LALR(1) parser generator for Java)

The Java Virtual Machine Specification, 2nd ed (defines the semantics of Java bytecode)

Jasmin (an assembler for Java bytecode)

BCEL - the Byte Code Engineering LIbrary

BCEL API documentation

Example Code

compilerExample.zip - Example Eclipse project showing how to write a simple JFlex lexer and CUP parser.  CUP version 11a and JFlex version 1.4.1 are included in the project, so you should not need any external software installed in order to compile and run it.

calc_partialSolution.zip - Partial solution to Lab 2.

calc_solution.zip - (Almost) complete solution to Lab 2.

calc_ast.zip - Modified version of calculator that builds ASTs and evaluates them

calc_astVisitor.zip - Modified version of calculator that evaluates ASTs using a visitor

calc_codegen.zip - Modified version of calculator that emits "MiniJVM" bytecode instructions (solution to lab 3)

splCompiler.jar - This is my implementation of the SPL compiler.  It has a GUI; just double-click on the .jar file.


Assignment File(s) Due
Assignment 1: Expression Grammars n/a Thursday, February 7th by 11:59 PM
Assignment 2: Lexical Analysis CS496_Assign2.zip Tuesday, March 4th by 11:59 PM
Assignment 3: Parsing
Updated 4/1
BetterSymbol.java, Main.java, assign3testprogs.zip Thursday, April 3rd by 11:59 PM
Assignment 4: Abstract Syntax Trees ASTNode.java, ASTNodeType.java, ASTNodeVisitor.java, RecursiveASTNodeVisitor.java, Location.java, Main.java Thursday, April 17th by 11:59 PM
Assignment 5: Semantic Analysis, Code Generation see the assignment description Thursday, May 1st by 11:59 PM


Date Lab File
Feb 12th Lexical analysis using JFlex lab1.zip
Mar 11th Parsing using CUP lab2.zip
Apr 8thCode generationlab3.zip