Chapter 7: Intermediate representation and symbol table

 

. most closely nested scope rule can be implemented in data structures discussed so far

. give each procedure a unique number

. blocks must also be numbered

. procedure number is part of all local declarations

. name is represented as a pair of number and name

. names are entered in symbol table in the order they occur

. most closely nested rule can be created in terms of following operations:

- lookup: find the most recently created entry

- insert: make a new entry

- delete: remove the most recently created entry

Most closely nested scope rules can be implemented by adapting the data structures discussed in the previous section. Each procedure is assigned a unique number. If the language is block-structured, the blocks must also be assigned unique numbers. The name is represented as a pair of a number and a name. This new name is added to the symbol table. Most scope rules can be implemented in terms of following operations:

a) Lookup - find the most recently created entry.

b) Insert - make a new entry.

c) Delete - remove the most recently created entry.