5.5 Symbol Table Handling

We already had a preliminary discussion about Symbol Tables in Chapter 3, Section 3.2. A Symbol Table exists throughout the compilation steps. Major operations required for a symbol table are:

  • insertion,
  • search,
  • modify contents of a node,
  • deletions are purely logical (depending on scope and visibility) and not physical,
  • keywords are often stored in the symbol table before the compilation process begins, so that Scanner and Parser are able to trap them.

The Symbol Table is accessed at every stage of the compilation process:

Scanning: Insertion of new identifiers.

Parsing: Access to ensure that an operand exists.

Semantic analysis:

  • Determination of types of identifiers from declarations,
  • Type checking to ensure that ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.