Chapter 8: Intermediate Code Generation

Creating symbol table

. mktable (previous)

create a new symbol table and return a pointer to the new table. The argument previous points to the enclosing procedure

. enter (table, name, type, offset)

creates a new entry

. addwidth (table, width)

records cumulative width of all the entries in a table

. enterproc (table, name, newtable)

creates a new entry for procedure name. newtable points to the symbol table of the new procedure

The following operations are designed :

1. mktable(previous): creates a new symbol table and returns a pointer to this table. previous is pointer to the symbol table of parent procedure.

2. enter(table,name,type,offset): creates a new entry for name in the symbol table pointed to by table .

3. addwidth(table,width): records cumulative width of entries of a table in its header.

4. enterproc(table,name ,newtable): creates an entry for procedure name in the symbol table pointed to by table . newtable is a pointer to symbol table for name .