4.7 Symbol Table and Parser

We already had a preliminary discussion about Symbol Tables in Chapter 3 (Section 3.2). A Symbol Table exists throughout the compilation steps, but it has a rather limited role in the Parser. Basically, it accesses the Symbol Table to ensure that an operand exists. There are certain identifiers of which the Parser should be aware of, such as keywords, built-in functions and pre-defined constants and variables. They are often stored in the symbol table before the compilation process begins, so that Scanner and Parser are able to trap them. Also, user-defined declarations of variable and functions should be entered in the Symbol Table by the Parser for later processing by the semantic phase – like type checking, argument ...

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.