Dr. Chuck C. Liang
Professor of Computer Science, Hofstra University .
201A Adams Hall
Hempstead, NY 11550
Office Phone: (516 463) 5559
Email: email@example.com (<- click to send me mail)
Official Office Hours: Monday-Thursday 3:30-4:30pm
The homepage of the previous time that I taught this course is available here
The following are the components of my "jBASIC" sample interpreter. Although it is an interpreter as opposed to a compiler, it contains many of the same basic components as a compiler.
Lambdascript example: programming with pure lambda terms using Krivine's
java implementation, LR(1) grammar and sample program.
Some sample grammars (in my syntax):
Sample hand-coded x86 assembly language programs in gnu syntax:
fibonacci sequence, summing an array
Simple expression trees and code generation. (CORRECTED)
The Truth Lab. (progressive assignment - reload for latest).
Some guidelines, code fragments, are found here.
Parser Generator Stage 1. The content of this assignment will be the subject of your next progress grade. I've added my version of the function to compute the Nuillible set. Reload for latest
Parser Generator Stage 2: Generating the State Machine.
Parser Generator Stage 3: Generating the Parser.
Parser Generator Final.
MiniJava+ compiler project overview
Lexer and Parser (RELOAD BOTH FILES). Due Tuesday 4/1
Abstract Syntax and Visitor Pattern (now with Translator). Due Thursday 4/10
Symbol Table and Type Checker. Due Thursday 4/17
Additional guidelines for type checking
x86 assembly language assignment
Generating code for intermediate machine, which can then use my 32 bit coder (RELOAD FOR LATEST) to generate a real .s file.
Here's a simple minijava+ program with only main. The following are several versions of compiled assemblies in that uses increasing levels of optimization:
Compiler Final Preparation UPDATED
Example involving objects, methods and arrays: test2.mj and its generated code (non-optimized).
Another example, this time a function returns an array: test3.mj, with generated code, this time more optimized.
More Minijava+ programs to test your compiler on: test.mj, fact.mj, Quicksort.mj, BinaryTree.mj
fact3b.mj program for 5/8 workshop
The scheduled time of the final session is Thursday 5/15 at 6:15pm.
Next progress grade (last one before final) will be given on Tuesday 5/6. You must be able to compile fact3.mj.
Minijava+ program to test type checking
Program to test your assembler: power2.c. Follow instructions in comments.
test cases for parser generator:
Nasty grammars for testing stage 2: nasty1, nasty2, nasty3
Read Chapter 2,3,4,5 of textbook.