コード例 #1
0
 String dumpFER() {
   String forprint = "";
   forprint += "(<" + symtab.printBindings() + ">, " + name + ", ";
   if (startLine == 0) {
     forprint += "-, ";
   } else {
     forprint += startLine + ", ";
   }
   if (endLine == 0) {
     forprint += "-, ";
   } else {
     forprint += endLine + ", ";
   }
   if (currentLine == 0) {
     forprint += "-)";
   } else {
     forprint += currentLine + ")";
   }
   return forprint;
 }
コード例 #2
0
 public FunctionEnvironmentRecord() {
   symtab = new SymbolTable();
   symtab.beginScope();
 }
コード例 #3
0
 /** @return a string of id's in the Symbol Table. */
 public Set<String> getVars() {
   return symtab.keys();
 }
コード例 #4
0
 /**
  * Removes the last n id/offset pairs from the Symbol Table.
  *
  * @param n - the number of pairs to remove from the Symbol Table
  */
 public void popPairs(int n) {
   symtab.endScope(n);
 }
コード例 #5
0
 /**
  * Enters an id/offset pair into the Symbol Table.
  *
  * @param var - the id
  * @param offset - the offset of the variable in the stack
  */
 public void enterPair(String var, int offset) {
   symtab.put(var, offset);
 }