|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.assembler.SymbolTable
public class SymbolTable
Creats a table of Symbol objects.
Field Summary | |
---|---|
static int |
NOT_FOUND
|
Constructor Summary | |
---|---|
SymbolTable(String filename)
Create a new empty symbol table for given file |
Method Summary | |
---|---|
void |
addSymbol(Token token,
int address,
boolean b,
ErrorList errors)
Adds a Symbol object into the array of Symbols. |
void |
clear()
Creates a fresh arrayList for a new table. |
void |
fixSymbolTableAddress(int originalAddress,
int replacementAddress)
Fix address in symbol table entry. |
int |
getAddress(String s)
Method to return the address associated with the given label. |
int |
getAddressLocalOrGlobal(String s)
Method to return the address associated with the given label. |
ArrayList |
getAllSymbols()
For obtaining all the Symbols. |
ArrayList |
getDataSymbols()
For obtaining the Data Symbols. |
int |
getSize()
Get the count of entries currently in the table. |
static String |
getStartLabel()
Fetches the text segment label (symbol) which, if declared global, indicates the starting address for execution. |
Symbol |
getSymbol(String s)
Produce Symbol object from symbol table that corresponds to given String. |
Symbol |
getSymbolGivenAddress(String s)
Produce Symbol object from symbol table that has the given address. |
Symbol |
getSymbolGivenAddressLocalOrGlobal(String s)
Produce Symbol object from either local or global symbol table that has the given address. |
ArrayList |
getTextSymbols()
For obtaining the Text Symbols. |
void |
removeSymbol(Token token)
Removes a symbol from the Symbol table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NOT_FOUND
Constructor Detail |
---|
public SymbolTable(String filename)
filename
- name of file this symbol table is associated with. Will be
used only for output/display so it can be any descriptive string.Method Detail |
---|
public void addSymbol(Token token, int address, boolean b, ErrorList errors)
token
- The token representing the Symbol.address
- The address of the Symbol.b
- The type of Symbol, true for data, false for text.errors
- List to which to add any processing errors that occur.public void removeSymbol(Token token)
token
- The token representing the Symbol.public int getAddress(String s)
s
- The label.
public int getAddressLocalOrGlobal(String s)
s
- The label.
public Symbol getSymbol(String s)
s
- target String
public Symbol getSymbolGivenAddress(String s)
s
- String representing address
public Symbol getSymbolGivenAddressLocalOrGlobal(String s)
s
- String representing address
public ArrayList getDataSymbols()
public ArrayList getTextSymbols()
public ArrayList getAllSymbols()
public int getSize()
public void clear()
public void fixSymbolTableAddress(int originalAddress, int replacementAddress)
originalAddress
- Address associated with 0 or more symtab entries.replacementAddress
- Any entry that has originalAddress will have its
address updated to this value. Does nothing if none do.public static String getStartLabel()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |