coins.sym
クラス SymTableImpl

java.lang.Object
  |
  +--coins.sym.SymTableImpl
すべての実装インタフェース:
SymTable

public class SymTableImpl
extends java.lang.Object
implements SymTable

SymTableImpl -- Symbol tabel class implementing SymTable.


フィールドの概要
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
           
 
コンストラクタの概要
SymTableImpl(SymRoot pSymRoot)
           
 
メソッドの概要
 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, ...)
 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()
           
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

symRoot

public final SymRoot symRoot

ioRoot

public final IoRoot ioRoot

fTableName

public java.lang.String fTableName

firstSym

protected Sym firstSym
Symbols in this symbol table


lastSym

protected Sym lastSym

ownerSym

protected Sym ownerSym

fDbgLevel

protected final int fDbgLevel
コンストラクタの詳細

SymTableImpl

public SymTableImpl(SymRoot pSymRoot)
メソッドの詳細

pushSymTable

public SymTable pushSymTable(Sym pOwner)
インタフェース SymTable の記述:
pushSymTable Make this (current) symbol table as an ancestor symbol table and create a new symbol table making it as the current symbol table. Linkage between the new current symbol table and the ancestor symbol table is made and the new current symbol table is made a direct descendant symbol table of the ancestor. "this" should be the current symbol table that is to be made as the ancestor. If pOwner is a subprogram, then symRoot.subpCurrent is set to pOwner and symRoot.symTableCurrentSubp is set to the created symbol tablbe.

定義:
インタフェース SymTable 内の pushSymTable
パラメータ:
pOwner - Symbol owning the the new SymTable (subprogram, etc.), null if no symbol corresponds.
戻り値:
the newly created current symbol table.

popSymTable

public SymTable popSymTable()
popSymTable Close this (current) symbol table and make its ancestor symbol table as the current symbol table if this has the ancestor. The closed symbol table can be reopened by reopenSymTable. "this" should be the current symbol table to be closed.

定義:
インタフェース SymTable 内の popSymTable
戻り値:
the ancestor symbol table that is resumed as the current symbol table. If this has no ancestor, then return null.

reopenSymTable

public 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. "this" should be the current symbol table that is to be made as the ancestor.

定義:
インタフェース SymTable 内の reopenSymTable
パラメータ:
pPreviousSymTable - a symbol table that was once a direct descendant symbol table of this symbol table.
戻り値:
pPreviousSymTable that is made as the new current symbol table.

getParent

public SymTable getParent()
インタフェース SymTable の記述:
getParent Get parent symbol table of this table.

定義:
インタフェース SymTable 内の getParent

getFirstChild

public SymTable getFirstChild()
インタフェース SymTable の記述:
getFirstChild

定義:
インタフェース SymTable 内の getFirstChild
戻り値:
the first child symbol table of this. If there is no child, return null.

getBrother

public SymTable getBrother()
インタフェース SymTable の記述:
getBrother

定義:
インタフェース SymTable 内の getBrother
戻り値:
the next brother symbol table of this. If there is no next brother, return null.

defineUnique

public 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. If there is already a symbol with the same name as pUniqueName, then it is treated as an erronous call and no new symbol is created. "this" should be the current symbol table.

定義:
インタフェース SymTable 内の defineUnique
パラメータ:
pSymKind - 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.
戻り値:
the new symbol having the name same to pUniqueName and whose symbol kind is pSymKind. If there is already a symbol with the same name as pUniqueName, then return null. Note: If pSymKind is either Sym.KIND_SUBP, Sym.KIND_VAR, Sym.KIND_ELEM, or Sym.KIND_CONST, etc. then either Subp, Var, Param, Elem, or Const instance is created each respectively. Several linkages are made between the defined symbol and pDefinedIn symbol (see definedIn(), FirstParam(), FirstLocalVar(), FirstElem(), NextVar(), NextSubp(), etc.) These rules are applied also to Define and redefine.

define

public 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. If there is already an old symbol with the same name as pUniqueName and with the same kind as pSymKind in this symbol table, then no new symbol is created and the old symbol is returned. Ancestor symbol tables are not traversed to find the same symbol. "this" should be the current symbol table.

定義:
インタフェース SymTable 内の define
パラメータ:
pSymKind - 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.
戻り値:
the symbol having the name same to pUniqueName and whose symbol kind is pSymKind. If there is already a symbol with the same name as pUniqueName and the same kind as pSymKind, then return it.

search

public Sym search(java.lang.String pInternedName)
search Search the symbol specified by the parameter pInternedName in the current symbol table and its ancestors. The symbol is searched in the current symbol table first, and if not found, then searched in its direct ancestor, and if not found again, then searched in ancestor's ancestor, and so on. If there are more than one symbols having the same name then the one encountered first in the above search process is returned. "this" should be the current symbol table. See searchSymOfThisKind and redefine.

定義:
インタフェース SymTable 内の search
パラメータ:
pInternedName - unique string representing the symbol to be searched.
戻り値:
the symbol having the name same to pInternedName, where the symbol kind of the returned symbol may differ from that of pUniqueName given this time. If there is no same symbol then return null.

searchLocal

public Sym searchLocal(java.lang.String pInternedName,
                       int pSymKind,
                       boolean pSpecifiedKind)
searchLocal Search the symbol which is specified by parameter pInternedName. If pSpecifiedKind is ture, search the symbol which is same as pInternedName and pSymKind. And Searching is current symbol table only.

定義:
インタフェース SymTable 内の searchLocal
パラメータ:
pInternedName - symbol name which is Interned.
pSymKind - symbol kind.
pSpecifiedKind - If ture, search by name and kind.
戻り値:
Sym The symbol's name is same as pInternedName. If pSpecifiedKind is ture, kind is also same kind.

searchLocalEntry

public SymTableEntry searchLocalEntry(java.lang.String pInternedName,
                                      int pSymKind,
                                      boolean pSpecifiedKind)

searchOrAdd

public 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. If pWithinThisTable is false search all parents symbol table are as well as searched. If pSpecifiedKind is ture, search the symbol which is same as pInternedName and pSymKind. If the symbol is found and then return it. If not, make new symbol, then add to this symbol table.

定義:
インタフェース SymTable 内の searchOrAdd
パラメータ:
pSpecifiedKind - If ture, search the symbol which is same name as pInternedName and same kind as pSymKind.
戻り値:
Sym found symbol or generated symbol.

searchOrAddEntry

public SymTableEntry searchOrAddEntry(java.lang.String pInternedName,
                                      int pSymKind,
                                      Sym pDefinedIn,
                                      boolean pWithinThisTable,
                                      boolean pSpecifiedKind)
インタフェース SymTable の記述:
searchOrAddEntry Search a symbol table entry where a symbol is to be placed. This enables to get a SymTable slot to which a symbol is to be placed and then create the symbol object whereas searchOrAdd creates a symbol object in it if the symbol is not yet created.

定義:
インタフェース SymTable 内の searchOrAddEntry
戻り値:
a symbol table entry to which pInternedName is to be recorded; This is used to get blank symbol table entry corresponding to pInternedName and then write a symbol object to the entry by setEntrySym of SymTableEntry.

linkSym

public void linkSym(Sym pNewSym)
インタフェース SymTable の記述:
linkSym Link pNewSym as the last symbol of this symbol table. Set fRecordedIn of pNewSym as this symbol table.

定義:
インタフェース SymTable 内の linkSym

searchSymOfThisKind

public 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. If one is found then it is returned. If not found, then null is returned. "this" should be the current symbol table.

定義:
インタフェース SymTable 内の searchSymOfThisKind
パラメータ:
pSym - a symbol having the same name as the one to be searched.
pSymKind - kind of the symbol to be searched (see GlobalConstants).
戻り値:
the symbol whose name and kind are the same to those of pSym, or return null if not found.

redefine

public 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. "this" should be the current symbol table. Usage of redefine: If the source language permits the same name to be defined as a name of different kind in the same scope, then Search may return a symbol having the same name but with different kind. In that case, search ancestors again by searchSymOfThisKind and if not found, then use redefine to define the symbol as the new one of pSymKind. For example, enumerator may have the same name as that of some subprogram in C.

定義:
インタフェース SymTable 内の redefine
パラメータ:
pSymKind - 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.
戻り値:
the created symbol.

subpSymTable

public SymTable subpSymTable()
インタフェース SymTable の記述:
subpSymTable Get the symbol table of current subprogram. If this SymTable is a SymTable defined inside a subprogram, then get the SymTable of the enclosing subprogram. If current subprogram is not yet defined, then get symTableRoot. This method is used in generating temporal variable, etc.

定義:
インタフェース SymTable 内の subpSymTable

generateVar

public 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.). If subpCurrent is null, the variable is recorded in symTableRoot.

定義:
インタフェース SymTable 内の generateVar
パラメータ:
pType - type of the variable to be generated.
戻り値:
the generated variable.

generateVar

public Var generateVar(Type pType,
                       Sym pDefinedIn)
generateVar Generate a variable of type pType in this symbol table (to be used as temporal variable, etc.). "this" should be the current symbol table.

定義:
インタフェース SymTable 内の generateVar
パラメータ:
pType - 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.
戻り値:
the generated variable.

generateParam

public Param generateParam(Type pType,
                           Sym pDefinedIn)
インタフェース SymTable の記述:
generateParam Generate a parameter of type pType in subpSymTable(). The name starts with "_param". Anonymous parameter should be given a name (by generateParam). "this" should be symTableCurrentSubp.

定義:
インタフェース SymTable 内の generateParam
パラメータ:
pType - type of the parameter to be generated.
pDefinedIn - Subprogram defining the parameter.
戻り値:
the generated parameter.

generateElem

public Elem generateElem(Type pType,
                         Sym pDefinedIn)
インタフェース SymTable の記述:
generateElem Generate an element of type pType in this symbol table. The name starts with "_elem". "this" should be the current symbol table.

定義:
インタフェース SymTable 内の generateElem
パラメータ:
pType - type of the element to be generated.
pDefinedIn - language construct symbol that encloses the definition of the element (structure or union name).
戻り値:
the generated element.

generateLabel

public Label generateLabel()
インタフェース SymTable の記述:
generateLabel Generate an internal label in subpSymTable(). The name starts with "_lab".

定義:
インタフェース SymTable 内の generateLabel
戻り値:
the generated label.

generateTag

public Sym generateTag()
インタフェース SymTable の記述:
generateTag Generate a tag name in subpSymTable(). The name starts with "_tag".

定義:
インタフェース SymTable 内の generateTag
戻り値:
the generated tag symbol.

generateTag

public Sym generateTag(java.lang.String pTagName)
定義:
インタフェース SymTable 内の generateTag

generateSym

public 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.). "this" should be the current symbol table.

定義:
インタフェース SymTable 内の generateSym
パラメータ:
pType - 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.
戻り値:
the generated symbol. As for variable, parameter, element, label, use generateVar, generateParam, generateElem, generateLabel.

generateDerivedSym

public Sym generateDerivedSym(Sym pBaseSym)
インタフェース SymTable の記述:
generateDerivedSym Generate a symbol having the same type and kind as that of pSym in this symbol table. The generated name has a name beginning with the name of pSym preceeded by "_" and ending with one of suffixes _1, _2, _3, ... . The suffix is selected so that the same name does not appear in the symbol table. "this" should be symTableCurrentSubp or symTableCurrent.

定義:
インタフェース SymTable 内の generateDerivedSym
戻り値:
the generated symbol.

generateSymName

public java.lang.String generateSymName(java.lang.String pHeader)
Generate symbol name which is unique in this SymTable and its ancestors.

定義:
インタフェース SymTable 内の generateSymName
パラメータ:
pHeader - is a string to be used as header of the generated name.
戻り値:
the generated name

getSymIterator

public SymIterator getSymIterator()
インタフェース SymTable の記述:
getSymIterator Get iterator to scan all symbols recorded in this symbol table.

定義:
インタフェース SymTable 内の getSymIterator

getSymNestIterator

public SymNestIterator getSymNestIterator()
インタフェース SymTable の記述:
getSymNestIterator (##6) Get iterator to scan all symbols recorded in this symbol table and its children.

定義:
インタフェース SymTable 内の getSymNestIterator

getSymTableIterator

public SymTableIterator getSymTableIterator()
インタフェース SymTable の記述:
getSymTableIterator (##10) Get iterator to scan all symbols tables starting from this symbol table and its children.

定義:
インタフェース SymTable 内の getSymTableIterator

getFirstSym

public Sym getFirstSym()
インタフェース SymTable の記述:
getFirstSym Get the first symbol recorded in this symbol table. The rest of symbols can be get by getNextSym() of Sym interface. This method is not necessary when SymIterator is used.

定義:
インタフェース SymTable 内の getFirstSym

isInThisSymTable

public boolean isInThisSymTable(Sym pSym)
インタフェース SymTable の記述:
isInThisSymTable

定義:
インタフェース SymTable 内の isInThisSymTable
パラメータ:
pSym - Any symbol.
戻り値:
true if pSym is contained in this SymTable otherwise return false;

toString

public java.lang.String toString()
オーバーライド:
クラス java.lang.Object 内の toString

printSymTableAll

public void printSymTableAll(SymTable pSymTable)
インタフェース SymTable の記述:
printSymTableAll (##2) Print symbols in pSymTable and all its descendent symbol tables using printSymTable.

定義:
インタフェース SymTable 内の printSymTableAll
パラメータ:
pSymTable - any symbol table.

printSymTableAllDetail

public void printSymTableAllDetail()
インタフェース SymTable の記述:
printSymTableAllDetail with no param. Print symbols in pSymTable and all its descendent symbol tables using printSymTableDetail. This also print symRoot.symTableConst. and if dbgSym.getLevel() > 3, print symRoot.symTableUnique, too.

定義:
インタフェース SymTable 内の printSymTableAllDetail

printSymTableAllDetail

public void printSymTableAllDetail(SymTable pSymTable)
インタフェース SymTable の記述:
printSymTableAllDetail (##2) Print symbols in pSymTable and all its descendent symbol tables using printSymTableDetail.

定義:
インタフェース SymTable 内の printSymTableAllDetail
パラメータ:
pSymTable - any symbol table.

printSymTable

public void printSymTable()
インタフェース SymTable の記述:
printSymTable (##2) Print symbols in this symbol table using toString().

定義:
インタフェース SymTable 内の printSymTable

printSymTableDetail

public void printSymTableDetail()
printSymTableDetail Print this symbol table. printDetail: After executing printSymTable(), print other attributes. "this" may be any symbol table.

定義:
インタフェース SymTable 内の printSymTableDetail

getOwner

public Sym getOwner()
インタフェース SymTable の記述:
getOwner Get the owner node to which this symbol table is attached.

定義:
インタフェース SymTable 内の getOwner
戻り値:
the owner symbol (subprogram, block name, struct, union, etc.).

getOwnerName

public java.lang.String getOwnerName()
インタフェース SymTable の記述:
getOwnerName Get the name of the owner of this symbol table.

定義:
インタフェース SymTable 内の getOwnerName
戻り値:
the owner name. If the owner is null, return "null".

getSubp

public Subp getSubp()
インタフェース SymTable の記述:
getSubp Get the subprogram to which this symbol table is attached or in which the owner of this symbol table is contained.

定義:
インタフェース SymTable 内の getSubp
戻り値:
the subprogram owning or containing this symbol table.

getSymCount

public int getSymCount()
インタフェース SymTable の記述:
getSymCount Get the number of symbols recorded in the symbol table. (It will not be decreased even if a symbol is deleted.) Empty symbol table will return 0.

定義:
インタフェース SymTable 内の getSymCount

searchOrAddSym

public Sym searchOrAddSym(Sym s)
searchOrAddSym Add symbol s to this symbol table. If there is already the symbol in this table, then return it without adding the symbol. //## previous version public Sym entry(Sym s)

定義:
インタフェース SymTable 内の searchOrAddSym
パラメータ:
s - Symbol to be searched or added.
戻り値:
the symbol found or added.

search

public Sym search(java.lang.String pName,
                  int symkind)
search Search a symbol named pName starting from this symbol table and upward (ancestors).

定義:
インタフェース SymTable 内の search
パラメータ:
pName - name of the symbol to be serached.
symkind - symbol kind (Sym.KIND_VAR, etc.).
戻り値:
the symbol if found, null otherwise.

searchLocal

public Sym searchLocal(java.lang.String pName,
                       int symkind)
searchLocal Search a symbol named pName withis this symbol table without traversing other symbol table.

定義:
インタフェース SymTable 内の searchLocal
パラメータ:
pName - name of the symbol to be serached.
symkind - symbol kind (Sym.KIND_VAR, etc.).
戻り値:
the symbol if found in this symbol table, null otherwise.

searchTableHaving

public SymTable searchTableHaving(Sym s)
searchTableHaving Search a symbol symbol table containing the symbol named pName starting from this symbol table and upward (ancestors).

定義:
インタフェース SymTable 内の searchTableHaving
パラメータ:
s - Symbol to be searched if it is contained in some symbol table.
戻り値:
the symbol table containing the symbol s if found, null otherwise.

makeNewName

public java.lang.String makeNewName(java.lang.String pOldName,
                                    java.lang.String lSubpName,
                                    int index)

generateUniqueName

public java.lang.String generateUniqueName(Sym pOldSym,
                                           Subp pSubp)
インタフェース SymTable の記述:
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.

定義:
インタフェース SymTable 内の generateUniqueName
パラメータ:
pOldSym -
pSubp -
戻り値:
unique name string.

generateConstName

public java.lang.String generateConstName(Sym pOldSym,
                                          int index)

setUniqueNameToAllSym

public void setUniqueNameToAllSym()
インタフェース SymTable の記述:
setUniqueNameToAllSym Set unique name to all symbols of the kind Var, Param, Subp, Label in the whole compile unit. This operation is performed for all symbol tables under symTableRoot. Normally, this should be called only once after generating HIR for all subprograms and immediately before generating LIR (by ConvToNewLIR).

定義:
インタフェース SymTable 内の setUniqueNameToAllSym