Please Reload Every Time You Read This Page!

CPSC 371: Compiler Theory and Construction, Spring 1999

Dr. Chuck C. Liang
Visiting Assistant Professor of Computer Science

Office: MCEC 343, 300 Summit Street, Hartford, CT 06106-3100
Office Phone: (860 297) 5395
Email: chuck.liang@mail.trincoll.edu


Course Syllabus

Online Resources:


Assignment due Tuesday 2/2/99
Here is the sym.java file that you should use. It contains constant declarations for the various Tiger tokens.
Assignment due Tuesday 2/16/99
The Truth Lab
The adder program I wrote in class (2/16/99)
Assignment due 3/23/99
Sparc Assembly Lab and Assignment. Due 4/13/99.
First Compilation Assignment. Due 4/20.

Here are the components of my "jBASIC" interpreter:

  1. jbl.lex. The lexical scanner specification to be processed by JLex.
  2. jbp.cup. The LALR grammar specification to be processed by Java_Cup. The "semantic actions" of this file builds an abstract syntax tree representation, the classes of which are defined in the next file:
  3. jbclasses.java. This file contains classes for building abstract syntax trees for jBasic, as well as code that will execute a jBasic program given its abstract syntax representation.
  4. jbinterp.java. This is the top level file that combines the lexer/parser with the interpreter defined in the above file.
  5. factorial.jb. Here is a sample jBasic program that computes 5!.
  6. README. Instructions on how to put everything together and run the interpreter.

Here is a file that allows you to test your lexical analyzer without building a complete parser. There is a similar file found at http://www.cs.princeton.edu/~appel/modern/java/chap2/Parse/Main.java, which is part of the sample code provided by the text's author, but I like mine better :-). To use it, compile it (after your *.lex file has been processed and compiled) and type "java lextest < filename" while "filename" is the name of a sample source-code file of the source language.

Here's the Grm.cup I was writting in class (3/2/99). The original file is found in the tiger modules packages (tiger/chap4/Parse/Grm.cup).

SERIOUS HELP for the parser assignment. (includes initial portions of my .lex and .cup files)
Accompanying files:

  1. Yylex.class file for tiger. Use this instead of the one in tiger/chap4/Parse. This one returns java_cup.runtime.Symbol's. The initial portion of the file is included in the SERIOUS HELP file. This lexer was created with help from Scott Susslin.
  2. My Parse.java file, which you can use to replace the one in tiger/chap4/Parse/ . It includes a "main".
  3. Modified OpExp.java file that should go in tiger/chap4/Absyn/. Recompile it after downloading.
  4. Modified Print.java file that should go in tiger/chap4/Absyn/. Recompile it after downloading. This pretty printer works pretty well after the few bugs I've fixed. It's called from my Parse program.
  5. Here is the parse tree for the tiger program "queens.tig" printed out by my parser.
  6. Here is my "parser.class" file.

Type Checking version of jbclasses (my jBasic interpreter). Includes an implementation of the symbol table as a stack of stacks.

factorial.s Sample Sparc assembly code generated by gcc for a simple C program (this is the example we went through in class). Also contains instructions on using gcc.
mycounter.s Sample hand-coded assembly program.
myfun.s assembly program illustrating functions
mystrings.s string and buffer manipulation example
adder.java. UPDATED. Program I first went over in class on 4/13 - concerning compilation of expressions using a virtual stack, now updated with SIG series expressions (code demonstrated during last class).
Final Assignment. Due Tuesday, 5/11/99.


HERE THEY ARE!
test1.bob, test2.bob

Announcements: