Next: About this document ...
CS 405/505 ASSIGNMENT #9
Due Thursday, April 6, 2006
- 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 two attributes:
1) the function's local symbol
table containing all the identifiers within the function's scope, including
formal parameters and result value,
and
2) the intermediate code for the function represented as a syntax tree.
- Variable identifier - there will be three attributes:
1) the type (integer or array) of the variable,
2) whether the variable is a regular variable, formal parameter, or result
variable of a function (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 value of the variable (not assigned until run-time).
Details of the symbol table should be modelled after the environment domain
in the denotational semantics of MicroFortran.
- Output the local symbol table for each function as well as that of the
top-level function. You may output this after parsing each function or at the
end of the program.
Next: About this document ...
CS405 TA
2006-02-13