Docsity

CS405 Assignment 7: Symbol Table Management Routines, Assignments of Programming Languages

Toggle sidebar
bg1
CS405 Assignment 7
Due Nov 16, 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 value if any, and 3) print the symbol table. The symbol table will contain
the names of identifiers, whether the identifier denotes a procedure or variable, as well as
other attributes. These attributes are as follows:
Procedure identifier - 1) the procedure's local symbol table containing all the
identifiers within the procedure's scope, and 2) the intermediate code for the
procedure represented as a syntax tree.
Variable identifier - 1) the type of the variable 2) the relative address of the
variable (assuming every data value is size 1 and each procedure's variables start
at address 0).
2. After parsing each function, output the local symbol table and syntax tree for each
procedure. Also treat the whole source file as a global main procedure (though not
explicit indicated) and output the symbol table and the syntax tree for the global main
procedure.

Partial preview of the text

Download CS405 Assignment 7: Symbol Table Management Routines and more Assignments Programming Languages in PDF only on Docsity!

CS405 Assignment 7 Due Nov 16, 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 value if any, and 3) print the symbol table. The symbol table will contain the names of identifiers, whether the identifier denotes a procedure or variable, as well as other attributes. These attributes are as follows:  Procedure identifier - 1) the procedure's local symbol table containing all the identifiers within the procedure's scope, and 2) the intermediate code for the procedure represented as a syntax tree.  Variable identifier - 1) the type of the variable 2) the relative address of the variable (assuming every data value is size 1 and each procedure's variables start at address 0).
  2. After parsing each function, output the local symbol table and syntax tree for each procedure. Also treat the whole source file as a global main procedure (though not explicit indicated) and output the symbol table and the syntax tree for the global main procedure.