18 std::map<std::string, std::pair<ASTDeclNode *, bool>> functionNames;
19 std::map<ASTDeclNode *, std::map<std::string, ASTDeclNode *>> localNames;
20 std::vector<std::string> fieldNames;
24 std::map<std::string, std::pair<ASTDeclNode *, bool>> fMap,
25 std::map<
ASTDeclNode *, std::map<std::string, ASTDeclNode *>> lMap,
26 std::vector<std::string> fSet)
27 : functionNames(fMap), localNames(lMap), fieldNames(fSet) {}
71 void print(std::ostream &os);
Class for declaring a name, e.g., function, parameter, variable.
Definition: ASTDeclNode.h:7
Class for a program which is a name and a list of functions.
Definition: ASTProgram.h:11
Performs symbol analysis and records results for subsequent phases.
Definition: SymbolTable.h:17
std::vector< ASTDeclNode * > getFunctions()
Return the declaration nodes for functions in the program.
Definition: SymbolTable.cpp:34
void print(std::ostream &os)
Print symbol table contents to output stream.
Definition: SymbolTable.cpp:62
bool getPoly(std::string s)
Return an indication of whether the function was declared as polymorphic.
Definition: SymbolTable.cpp:26
ASTDeclNode * getFunction(std::string s)
Return the declaration node for a given function name.
Definition: SymbolTable.cpp:18
std::vector< ASTDeclNode * > getLocals(ASTDeclNode *f)
Return the declaration nodes for locals and parameters in a function.
Definition: SymbolTable.cpp:51
std::vector< std::string > getFields()
Returns the record field names referenced in the program.
Definition: SymbolTable.cpp:60
ASTDeclNode * getLocal(std::string s, ASTDeclNode *f)
Return the declaration node for local or a parameter in a function.
Definition: SymbolTable.cpp:42
static std::shared_ptr< SymbolTable > build(ASTProgram *p)
Perform symbol analysis and construct symbol table.
Definition: SymbolTable.cpp:10
SymbolTable(std::map< std::string, std::pair< ASTDeclNode *, bool >> fMap, std::map< ASTDeclNode *, std::map< std::string, ASTDeclNode * >> lMap, std::vector< std::string > fSet)
Definition: SymbolTable.h:23