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; }
public FunctionEnvironmentRecord() { symtab = new SymbolTable(); symtab.beginScope(); }
/** @return a string of id's in the Symbol Table. */ public Set<String> getVars() { return symtab.keys(); }
/** * 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); }
/** * 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); }