SymbolTableVisitor

class SymbolTableVisitor

Symbol table visitor

Visits symbol table tree (tree of scopes). The ability to jump to different scopes is also available

Constructors

SymbolTableVisitor
Link copied to clipboard
fun SymbolTableVisitor()
Create empty Symbol table visitor

Functions

addVariable
Link copied to clipboard
fun addVariable(identifier: String, data: SymbolTableData)
Add variableAdds a variable to the symbol table
enterScope
Link copied to clipboard
fun enterScope(): Int
Enter scopeEnters a new scope.
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getCurrentScopeID
Link copied to clipboard
fun getCurrentScopeID(): Int
Get current scopeIDReturns id of the current scope in scopes list.
getData
Link copied to clipboard
fun getData(identifier: String): SymbolTableData
Get dataGets the data for the identifier.
getFunctions
Link copied to clipboard
fun getFunctions(): Map<String, SymbolTableData>
Get functionsGets all defined functions currently visible in the current scope.
getTypeOf
Link copied to clipboard
fun getTypeOf(identifier: String): Type
Get type ofReturns type of identifier.
getVariableNames
Link copied to clipboard
fun getVariableNames(): Set<String>
Get variable namesReturns all variable names present in symbol table.
goToScope
Link copied to clipboard
fun goToScope(scopeID: Int)
Go to scopeSets current scope to that at the index scopeID in the scopes list.
hashCode
Link copied to clipboard
open fun hashCode(): Int
leaveScope
Link copied to clipboard
fun leaveScope()
Leave scopeUsually called when the end of a block of code is reached e.g.
toString
Link copied to clipboard
open fun toString(): String