Compiler Construction - CPSC 423
by Brad Rippe

I have put together this brief page of my 423 compiler project for other students to use as a reference for their compiler project. This was my project for Language Processor Technique Java Virtual Machine & Java Byte Code CPSC 423 by Professor Chang-Hyun Jo.

I have made the code available for students to modify and hopefully update code which they improve.

DISCLAIMER: THIS CODE AND INFROMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. USE AT YOUR OWN RISK.

The Methodology
The initial idea behind this project was to create a compiler Java Compiler that utilitized both C++ and Java to generate Java bytecode. However, through the development process the use of Java became less and less appealing with the performance hit of starting the JVM to do the work when C++ was already working well. So, the project became complete C++ code built with Object Oriented Design in mind. The idea was to construct separate objects that handle specific aspects of the compiler.

Architectural Overview - View Architecture in HTML
This project takes advantage of the STL utilizes the following data structures:
Vector
Map
Stack

The main components of the project is:
Main (Javaz.cpp) - the main class for the project.
CodeGenerator (CodeGenerator.h/CodeGenerator.cpp) - class contains all functions for generating java bytecode. Keep in mind that the code generator creates Jasmin Bytecode. Simple version of back patching uses xml tags to mark code, later replacing the xml with bytecode.
Syntactic Analyzer (Javaz.y) - The syntax analyzer valids the structure of the source code. Utilizes the code generator to generator java byte code.
Lexical Analyzer (Javaz.l) - Tokenizes the input source file. The lexical analyzer stores tokens in a token table, stores lines of code in a vector called srcFile and stores errors in a Vector called errs.

Initial Project Proposal - This file explains some of the tools used to create the compiler.

Known Issues

If you have implemented new features or bug fixes, feel free to contact me at brippe@fullcoll.edu. For more informaiton on Java please see my Java Course - CIS 226 Introduction to Java.

Source Code
javaz.zip (109Kb)