public class BuildSymbolTables extends StaticAnalysis
Constructor and Description |
---|
BuildSymbolTables() |
Modifier and Type | Method and Description |
---|---|
void |
finalizeScope()
Pop the stack and move outwards one scope level.
|
SymbolTable |
getCurrentTable()
Return the innermost active symbol table.
|
SymbolTable |
initializeScope()
Create a new innermost symbol table scope and push it on the stack.
|
void |
insertFunctionSymbol(ASTFunction node)
Add a symbol for the given function to the current (innermost) scope.
|
void |
insertParamSymbol(ASTFunction.Parameter p)
Add a symbol for the given function parameter to the current (innermost) scope.
|
void |
insertPrintFunctionSymbol(String name,
ASTNode.DataType type)
Add a symbol for a hard-coded function to the current (innermost) scope.
|
void |
insertVariableSymbol(ASTVariable node)
Add a symbol for the given variable to the current (innermost) scope.
|
void |
postVisit(ASTBlock node) |
void |
postVisit(ASTFunction node) |
void |
postVisit(ASTProgram node) |
void |
preVisit(ASTBlock node) |
void |
preVisit(ASTFunction node) |
void |
preVisit(ASTProgram node) |
void |
preVisit(ASTVariable node) |
addError, addError, getErrors, getErrorString, resetErrors
defaultInVisit, defaultPostVisit, defaultPreVisit, inVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, postVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit, preVisit
public SymbolTable getCurrentTable()
public SymbolTable initializeScope()
public void finalizeScope()
public void insertFunctionSymbol(ASTFunction node)
node
- Function to addpublic void insertVariableSymbol(ASTVariable node)
node
- Variable to addpublic void insertParamSymbol(ASTFunction.Parameter p)
p
- Parameter to addpublic void insertPrintFunctionSymbol(String name, ASTNode.DataType type)
name
- Function nametype
- Function argument typepublic void preVisit(ASTProgram node)
preVisit
in interface ASTVisitor
preVisit
in class DefaultASTVisitor
public void postVisit(ASTProgram node)
postVisit
in interface ASTVisitor
postVisit
in class DefaultASTVisitor
public void preVisit(ASTFunction node)
preVisit
in interface ASTVisitor
preVisit
in class DefaultASTVisitor
public void postVisit(ASTFunction node)
postVisit
in interface ASTVisitor
postVisit
in class DefaultASTVisitor
public void preVisit(ASTBlock node)
preVisit
in interface ASTVisitor
preVisit
in class DefaultASTVisitor
public void postVisit(ASTBlock node)
postVisit
in interface ASTVisitor
postVisit
in class DefaultASTVisitor
public void preVisit(ASTVariable node)
preVisit
in interface ASTVisitor
preVisit
in class DefaultASTVisitor
Copyright © 2019. All rights reserved.