ASSIGNMENT #7
Due Thursday, March 18, 2004
- 1.
Design and implement symbol table management routines to store all of the
identifiers used in a program. Specifically, you should have operations to
1) add an identifier to the symbol table, 2) look up an identifier
in the symbol table to see if it is there or not, returning the denotable
value if it is, and 3) print the symbol table.
The symbol table will contain the names of identifiers, whether the
identifier denotes a function or variable,
as well as other attributes. These attributes are as follows:
-
Function identifier - there will be three attributes: 1) the type of the
function return value (integer or List), 2) the function's local symbol
table containing all the identifiers within the function's scope, including
formal parameters,
and 3) the intermediate code for the function represented as a syntax tree.
-
Variable identifier - there will be three attributes: 1) the type of
the variable (integer or List), 2) whether the variable is a formal
parameter or not (this can also be handled by partitioning the symbol
table into discernible units, one for the formal parameters and one for
the regular variables), and 3) the relative address of the variable (assuming
every data value is size 1 and each function's variables start at address 0).
- 2.
After parsing each function, including main, output the local symbol
table and syntax tree for the function.
Also output the (global) symbol table for the program
after parsing it.
More details about the structure of the symbol table may be found in the
denotational semantics of MicroC++.
No late assignments will be accepted due to the impending Spring break.
CS405 TA
2004-02-24