Dr. Chuck C. Liang
Associate 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: MW 5:30-6:30pm, F 1-2pm or by appointment.
The following are the components of my "jBASIC" sample interpreter. Although it is an interpreter as oppposed to a compiler, it contains many of the same basic components as a compiler.
Sample JLex Specification and
usage. Additional JLex example from the
Paper on elimination of left recursion. Required reading for graduate students.
Online Calculator Example:
Sample hand-coded x86 assembly for
gcd and fibonacci functions. Use gcc as assembler.
Assignment 1. Due 2/9.
Assignment 2: Lexical Analyzer. Due 2/16. Support files: sym.java, mjlexertest.java
THE TRUTH LAB. Due Thursday 3/16 (firm). with truth.lex.
Compiler stage 2 :
part 2A, with parsertest.java (due Tuesday 3/21).
parts 2B and 2C. (due Thursday 3/23)
Visitor Pattern warmup assignment.
part 2D: MiniJava to C++ translator. With front end transcpp.java and cpputils.cpp.
Sample translations: MJtest.mj and MJtest.cpp; with extensions: MJplustest.mj and MJplustest.cpp
Compiler stage 3: Symbol tables and type checking
Assembly language warmup assignment
sample program from 4/18 class.
Compiler Stage 4a: Beginning Code Generation
with abstract assembly structures and front-end.
Completing the Code Generator
Sample Minijava programs to test: simple.mj
(main only), MJ4b.mj.
Sample generated code (after peephole optimization): simple.s, MJ4b.s
Clarifications on how to use immediate operands and memlabel class
Miscellaneous notes about division and other issues
Some peephole optimization routines
More test cases for you to compile: fact.mj (must deal with this.f(...)). bbs.mj (bubblesort, arrays). teams.mj (objects as parameters).
Final test cases: nestedifs.mj, funobj.mj, and newobj.mj
We will meet Thursday at the regular class time for the final demonstrations. I will prepare a number of test cases for you, some of which I will give you at the final demonstration. Attendance Thursday is absolutely required. You must demonstrate and submit your complete compiler.
In order to get the highest possible scores, you should also complete the type checker. Here's an additional hint on how to do that.
Please see more notes and other miscellaneous comments above.
Read chapters 4,5,6 of the text.