Chapter 7: Intermediate representation and symbol table

Global Symbol table structure

. scope and visibility rules determine the structure of global symbol table

. for Algol class of languages scoping rules structure the symbol table as tree of local tables

- global scope as root

- tables for nested scope as children of the table for the scope they are nested in

The global symbol table will be a collection of symbol tables connected with pointers. The exact structure will be determined by the scope and visibility rules of the language. Whenever a new scope is encountered a new symbol table is created. This new table contains a pointer back to the enclosing scope's symbol table and the enclosing one also contains a pointer to this new symbol table. Any variable used inside the new scope should either be present in its own symbol table or inside the enclosing scope's symbol table and all the way up to the root symbol table. A sample global symbol table is shown in the slides later.