CS 224 Project 3 - Jack Symbol Table

Objectives
Build the symbol table module for the Jack Compiler

Description:
Take a look at the project in Chapter 11 of N2T and complete Stage 1 as described on p243. You will implement the symbol table module and extend the syntax analyzer to output for each identifier its category and whether the identifier is being defined or used, as well as the identifier's kind and index from the symbol table.

Process:
Define two new Java classes STEntry and SymbolTable.  The STEntry defines the objects that will be stored in the symbol table.  For each identifier in the symbol table we need to know its kind (var, argument, static, field, class, or subroutine), its type, and its index.  The symbol table itself will be implemented with two hashtables for the class-scope symbol table and the method-scope symbol table (see p236 for an example).  The keys for the hashtables will be the identifier names.  You will need to keep track of the index values for the various memory segments, static, field, variables, and arguments, as you store new values into the symbol table.

Add in your CompilationEngine the additional prints whenever you encounter an identifier to display whether the identifier is being defined or used.  Also print the type, kind, and index for the identifier.

Academic integrity is very important as you embark upon this project.  Wrestling and finally mastering the concepts needed to complete this project will greatly improve your understanding of how programming languages work. Since your learning is the highest priority to me, I want to clearly emphasize the following:

  1. The process of figuring out what you need to do to complete the project is where the learning is happening.  By cheating and looking at an online or another student solution, you are robbing yourself of this learning.  Remember that learning is why you are here, right?!
  2. You will sometimes find yourself frustrated and stuck as you embark upon this learning process.  When this happens, instead of cheating yourself by looking at a solution, talk out your problem with me or a fellow student. 
  3. Helping a fellow student does not involve giving them code but you can explain to them how to proceed.  Doing so benefits both the student getting assistance and the student helping out.

Submission and Grading:
Submit your zipped project code in GoucherLearn by the due date even if it is not working perfectly.  After I have graded on the correctness of your code and made comments, if you have errors I will ask you to resubmit after making the changes I suggest.  In doing so, you will have the opportunity to earn back up to 50% of the points you lost in the first submission.  You will need a symbol table for the rest of the project so it is important that you get this working.