|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.sym.SymTableImpl
SymTableImpl -- Symbol tabel class implementing SymTable.
| Field Summary | |
protected int |
fDbgLevel
|
protected Sym |
firstSym
Symbols in this symbol table |
java.lang.String |
fTableName
|
IoRoot |
ioRoot
|
protected Sym |
lastSym
|
protected Sym |
ownerSym
|
SymRoot |
symRoot
|
| Constructor Summary | |
SymTableImpl(SymRoot pSymRoot)
|
|
| Method Summary | |
Sym |
define(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn)
define Define a new symbol specified by the parameter pUniqueName in the current symbol table. |
Sym |
defineUnique(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn)
defineUnique Define a new symbol specified by the parameter pUniqueName in the current symbol table without traversing ancestor symbol tables. |
java.lang.String |
generateConstName(Sym pOldSym,
int index)
|
Sym |
generateDerivedSym(Sym pBaseSym)
generateDerivedSym Generate a symbol having the same type and kind as that of pSym in this symbol table. |
Elem |
generateElem(Type pType,
Sym pDefinedIn)
generateElem Generate an element of type pType in this symbol table. |
Label |
generateLabel()
generateLabel Generate an internal label in subpSymTable(). |
Param |
generateParam(Type pType,
Sym pDefinedIn)
generateParam Generate a parameter of type pType in subpSymTable(). |
Sym |
generateSym(Type pType,
int pSymKind,
java.lang.String pPrefix,
Sym pDefinedIn)
generateSym Generate a symbol of type pType in this symbol table (to be used as block name, etc.). |
java.lang.String |
generateSymName(java.lang.String pHeader)
Generate symbol name which is unique in this SymTable and its ancestors. |
Sym |
generateTag()
generateTag Generate a tag name in subpSymTable(). |
Sym |
generateTag(java.lang.String pTagName)
|
java.lang.String |
generateUniqueName(Sym pOldSym,
Subp pSubp)
Generate unique name for symbols in the form of subprogramName_originalName_n, where, subprogramName is the name of the subprogram defining the symbol ("" for global symbol), oroginalName is the name of the symbol, n is sequence number (1, 2, 3, ...) attached to avoid duplication if there are same names declared in one subprogram. |
Var |
generateVar(Type pType)
generateVar Generate a variable of type pType in the symbol table of current subprogram symRoot.subpCurrent (to be used as temporal variable, etc.). |
Var |
generateVar(Type pType,
Sym pDefinedIn)
generateVar Generate a variable of type pType in this symbol table (to be used as temporal variable, etc.). |
SymTable |
getBrother()
getBrother |
SymTable |
getFirstChild()
getFirstChild |
Sym |
getFirstSym()
getFirstSym Get the first symbol recorded in this symbol table. |
Sym |
getOwner()
getOwner Get the owner node to which this symbol table is attached. |
java.lang.String |
getOwnerName()
getOwnerName Get the name of the owner of this symbol table. |
SymTable |
getParent()
getParent Get parent symbol table of this table. |
Subp |
getSubp()
getSubp Get the subprogram to which this symbol table is attached or in which the owner of this symbol table is contained. |
int |
getSymCount()
getSymCount Get the number of symbols recorded in the symbol table. |
SymIterator |
getSymIterator()
getSymIterator Get iterator to scan all symbols recorded in this symbol table. |
SymNestIterator |
getSymNestIterator()
getSymNestIterator (##6) Get iterator to scan all symbols recorded in this symbol table and its children. |
SymTableIterator |
getSymTableIterator()
getSymTableIterator (##10) Get iterator to scan all symbols tables starting from this symbol table and its children. |
boolean |
isInThisSymTable(Sym pSym)
isInThisSymTable |
void |
linkSym(Sym pNewSym)
linkSym Link pNewSym as the last symbol of this symbol table. |
java.lang.String |
makeNewName(java.lang.String pOldName,
java.lang.String lSubpName,
int index)
|
SymTable |
popSymTable()
popSymTable Close this (current) symbol table and make its ancestor symbol table as the current symbol table if this has the ancestor. |
void |
printSymTable()
printSymTable (##2) Print symbols in this symbol table using toString(). |
void |
printSymTableAll(SymTable pSymTable)
printSymTableAll (##2) Print symbols in pSymTable and all its descendent symbol tables using printSymTable. |
void |
printSymTableAllDetail()
printSymTableAllDetail with no param. |
void |
printSymTableAllDetail(SymTable pSymTable)
printSymTableAllDetail (##2) Print symbols in pSymTable and all its descendent symbol tables using printSymTableDetail. |
void |
printSymTableDetail()
printSymTableDetail Print this symbol table. |
SymTable |
pushSymTable(Sym pOwner)
pushSymTable Make this (current) symbol table as an ancestor symbol table and create a new symbol table making it as the current symbol table. |
Sym |
redefine(Sym pSym,
int pSymKind,
Sym pDefinedIn)
redefine Create a new symbol that has the name same as this symbol but having the symbol kind indicated by the parameter pSymKind in the current symbol table. |
SymTable |
reopenSymTable(SymTable pPreviousSymTable)
reopenSymTable Push this (current) symbol table as the ancestor symbol table and make the symbol table specified by the parameter as the new current symbol table. |
Sym |
search(java.lang.String pInternedName)
search Search the symbol specified by the parameter pInternedName in the current symbol table and its ancestors. |
Sym |
search(java.lang.String pName,
int symkind)
search Search a symbol named pName starting from this symbol table and upward (ancestors). |
Sym |
searchLocal(java.lang.String pName,
int symkind)
searchLocal Search a symbol named pName withis this symbol table without traversing other symbol table. |
Sym |
searchLocal(java.lang.String pInternedName,
int pSymKind,
boolean pSpecifiedKind)
searchLocal Search the symbol which is specified by parameter pInternedName. |
SymTableEntry |
searchLocalEntry(java.lang.String pInternedName,
int pSymKind,
boolean pSpecifiedKind)
|
Sym |
searchOrAdd(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn,
boolean pWithinThisTable,
boolean pSpecifiedKind)
searchOrAdd Search the symbol which is specified by parameter pInternedName, pSymKind. |
SymTableEntry |
searchOrAddEntry(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn,
boolean pWithinThisTable,
boolean pSpecifiedKind)
searchOrAddEntry Search a symbol table entry where a symbol is to be placed. |
Sym |
searchOrAddSym(Sym s)
searchOrAddSym Add symbol s to this symbol table. |
Sym |
searchSymOfThisKind(Sym pSym,
int pSymKind)
searchSymOfThisKind Search for the symbol having the same name as the parameter pSym and its kind is same to pSymKind in the same manner as Search. |
SymTable |
searchTableHaving(Sym s)
searchTableHaving Search a symbol symbol table containing the symbol named pName starting from this symbol table and upward (ancestors). |
void |
setUniqueNameToAllSym()
setUniqueNameToAllSym Set unique name to all symbols of the kind Var, Param, Subp, Label in the whole compile unit. |
SymTable |
subpSymTable()
subpSymTable Get the symbol table of current subprogram. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final SymRoot symRoot
public final IoRoot ioRoot
public java.lang.String fTableName
protected Sym firstSym
protected Sym lastSym
protected Sym ownerSym
protected final int fDbgLevel
| Constructor Detail |
public SymTableImpl(SymRoot pSymRoot)
| Method Detail |
public SymTable pushSymTable(Sym pOwner)
SymTable
pushSymTable in interface SymTablepOwner - Symbol owning the the new SymTable
(subprogram, etc.), null if no symbol corresponds.
public SymTable popSymTable()
popSymTable in interface SymTablepublic SymTable reopenSymTable(SymTable pPreviousSymTable)
reopenSymTable in interface SymTablepPreviousSymTable - a symbol table that was once
a direct descendant symbol table of this symbol table.
public SymTable getParent()
SymTable
getParent in interface SymTablepublic SymTable getFirstChild()
SymTable
getFirstChild in interface SymTablepublic SymTable getBrother()
SymTable
getBrother in interface SymTable
public Sym defineUnique(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn)
defineUnique in interface SymTablepSymKind - kind of the symbol to be created (see GlobalConstants).pDefinedIn - symbol representing language construct such as
subprogram name or structure name that encloses the definition of
the symbol to be defined. If there is no such construct, specify null.
(See definedIn().)pInternedName - unique string representing the symbol to be defined.
public Sym define(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn)
define in interface SymTablepSymKind - kind of the symbol to be created (see GlobalConstants).pDefinedIn - language construct symbol that encloses the definition
of pUniqueName. If there is no such construct, specify null.pInternedName - unique string representing the symbol to be defined.
public Sym search(java.lang.String pInternedName)
search in interface SymTablepInternedName - unique string representing the symbol to be searched.
public Sym searchLocal(java.lang.String pInternedName,
int pSymKind,
boolean pSpecifiedKind)
searchLocal in interface SymTablepInternedName - symbol name which is Interned.pSymKind - symbol kind.pSpecifiedKind - If ture, search by name and kind.
public SymTableEntry searchLocalEntry(java.lang.String pInternedName,
int pSymKind,
boolean pSpecifiedKind)
public Sym searchOrAdd(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn,
boolean pWithinThisTable,
boolean pSpecifiedKind)
searchOrAdd in interface SymTablepSpecifiedKind - If ture, search the symbol which is same name as pInternedName and same kind as pSymKind.
public SymTableEntry searchOrAddEntry(java.lang.String pInternedName,
int pSymKind,
Sym pDefinedIn,
boolean pWithinThisTable,
boolean pSpecifiedKind)
SymTable
searchOrAddEntry in interface SymTablepublic void linkSym(Sym pNewSym)
SymTable
linkSym in interface SymTable
public Sym searchSymOfThisKind(Sym pSym,
int pSymKind)
searchSymOfThisKind in interface SymTablepSym - a symbol having the same name as the one to be searched.pSymKind - kind of the symbol to be searched (see GlobalConstants).
public Sym redefine(Sym pSym,
int pSymKind,
Sym pDefinedIn)
redefine in interface SymTablepSymKind - symbol kind of the symbol to be created.pDefinedIn - language construct symbol that encloses the definition
of pSym. If there is no such construct, specify null.
public SymTable subpSymTable()
SymTable
subpSymTable in interface SymTablepublic Var generateVar(Type pType)
generateVar in interface SymTablepType - type of the variable to be generated.
public Var generateVar(Type pType,
Sym pDefinedIn)
generateVar in interface SymTablepType - type of the variable to be generated.pDefinedIn - language construct symbol that encloses the
definition of the generated variable. If there is no such
construct, specify null.
public Param generateParam(Type pType,
Sym pDefinedIn)
SymTable
generateParam in interface SymTablepType - type of the parameter to be generated.pDefinedIn - Subprogram defining the parameter.
public Elem generateElem(Type pType,
Sym pDefinedIn)
SymTable
generateElem in interface SymTablepType - type of the element to be generated.pDefinedIn - language construct symbol that encloses the
definition
of the element (structure or union name).
public Label generateLabel()
SymTable
generateLabel in interface SymTablepublic Sym generateTag()
SymTable
generateTag in interface SymTablepublic Sym generateTag(java.lang.String pTagName)
generateTag in interface SymTable
public Sym generateSym(Type pType,
int pSymKind,
java.lang.String pPrefix,
Sym pDefinedIn)
generateSym in interface SymTablepType - type of the symbol to be generated.pSymKind - symbol kind number of the symbol to be generated.pPrefix - prefix to be attached to the symbol name.pDefinedIn - language construct symbol that encloses the
definition of the generated variable. If there is no such
construct, specify null.
public Sym generateDerivedSym(Sym pBaseSym)
SymTable
generateDerivedSym in interface SymTablepublic java.lang.String generateSymName(java.lang.String pHeader)
generateSymName in interface SymTablepHeader - is a string to be used as header of the generated name.
public SymIterator getSymIterator()
SymTable
getSymIterator in interface SymTablepublic SymNestIterator getSymNestIterator()
SymTable
getSymNestIterator in interface SymTablepublic SymTableIterator getSymTableIterator()
SymTable
getSymTableIterator in interface SymTablepublic Sym getFirstSym()
SymTable
getFirstSym in interface SymTablepublic boolean isInThisSymTable(Sym pSym)
SymTable
isInThisSymTable in interface SymTablepSym - Any symbol.
public java.lang.String toString()
public void printSymTableAll(SymTable pSymTable)
SymTable
printSymTableAll in interface SymTablepSymTable - any symbol table.public void printSymTableAllDetail()
SymTable
printSymTableAllDetail in interface SymTablepublic void printSymTableAllDetail(SymTable pSymTable)
SymTable
printSymTableAllDetail in interface SymTablepSymTable - any symbol table.public void printSymTable()
SymTable
printSymTable in interface SymTablepublic void printSymTableDetail()
printSymTableDetail in interface SymTablepublic Sym getOwner()
SymTable
getOwner in interface SymTablepublic java.lang.String getOwnerName()
SymTable
getOwnerName in interface SymTablepublic Subp getSubp()
SymTable
getSubp in interface SymTablepublic int getSymCount()
SymTable
getSymCount in interface SymTablepublic Sym searchOrAddSym(Sym s)
searchOrAddSym in interface SymTables - Symbol to be searched or added.
public Sym search(java.lang.String pName,
int symkind)
search in interface SymTablepName - name of the symbol to be serached.symkind - symbol kind (Sym.KIND_VAR, etc.).
public Sym searchLocal(java.lang.String pName,
int symkind)
searchLocal in interface SymTablepName - name of the symbol to be serached.symkind - symbol kind (Sym.KIND_VAR, etc.).
public SymTable searchTableHaving(Sym s)
searchTableHaving in interface SymTables - Symbol to be searched if it is contained in some
symbol table.
public java.lang.String makeNewName(java.lang.String pOldName,
java.lang.String lSubpName,
int index)
public java.lang.String generateUniqueName(Sym pOldSym,
Subp pSubp)
SymTable
generateUniqueName in interface SymTablepOldSym - pSubp -
public java.lang.String generateConstName(Sym pOldSym,
int index)
public void setUniqueNameToAllSym()
SymTable
setUniqueNameToAllSym in interface SymTable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||