44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package Triangle.ContextualAnalyzer;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Stack;
|
|
|
|
import Triangle.AbstractSyntaxTrees.Declaration;
|
|
|
|
public final class SymbolTable {
|
|
|
|
private Map<String, Stack<Declaration>> symtab;
|
|
private List<List<String>> scopeStack;
|
|
|
|
public SymbolTable () {
|
|
}
|
|
|
|
// Opens a new level in the identification table, 1 higher than the
|
|
// current topmost level.
|
|
public void openScope () {
|
|
}
|
|
|
|
// Closes the topmost level in the identification table, discarding
|
|
// all entries belonging to that level.
|
|
public void closeScope () {
|
|
}
|
|
|
|
// Makes a new entry in the identification table for the given identifier
|
|
// and attribute. The new entry belongs to the current level.
|
|
// duplicated is set to to true if there is already an entry for the
|
|
// same identifier at the current level.
|
|
public void enter (String id, Declaration attr) {
|
|
}
|
|
|
|
// Finds an entry for the given identifier in the identification table,
|
|
// if any. If there are several entries for that identifier, finds the
|
|
// entry at the highest level, in accordance with the scope rules.
|
|
// Returns null if no entry is found.
|
|
// otherwise returns the attribute field of the entry found.
|
|
public Declaration retrieve (String id) {
|
|
return null;
|
|
}
|
|
|
|
}
|