CS 2734
Computer Organization II
Do the following prior to the laboratory.
make to be sure that you have downloaded
the programs correctly.
After you have parsed the line, output the outcome of the parse and any error messages.
assemblyErrorType getSymbolValue(const char *s, int *val);
/* If s is a symbol with a defined value, put its associated value
into *val and return NO_ERROR. Otherwise return the
appropriate error code:
SYMBOL_UNDEFINED - s is not in the symbol table
VALUE_UNDEFINED - s is in the table but its value is undefined
*/
assemblyErrorType insertSymbolTable(const char *s,
symbolInsertionType insert, int val);
/* Insert s in the symbol table. Possible types of insertion
include:
VALUE_ONLY - assign a value to a symbol that is already in
the table.
SYMBOL_ONLY - if the symbol is already in the table, take
no action. If the symbol is not in the table
insert it and assign its value to be undefined
BOTH - The val parameter
contains the value of the symbol for the first and third
types of insertion.
The possible error types are:
SYMBOL_UNDEFINED - tried to insert VALUE_ONLY for symbol
not in the table
DUPLICATE_VALUE - tried to insert a value for a symbol
that has been already defined
STORAGE_ERROR - couldn't malloc space for the symbol
UNKNOWN_INSERTION - insert was not one of three values
indicated above
*/
void outputSymbolTable (FILE *fp) /* Write the symbol table to the file fp. */
Implementation Notes:
PUSH 5
LODD 100 500
Revision Date: 3/7/97