THE SYMBOL TABLE
Motivation:
Previously, we have seen how source code is analysed as a series of tokens (lexical analysis), and how these tokens are analysed as a structured program (syntactic analysis).
These steps pay no regard to the variable names themselves, they only see each variable as a token “id”.
Syntactic analysis checks identifiers are used appropriately WITHIN each statement (locally)
Semantic analysis checks that identifiers are used appropriately within the program as a whole (globally)