Compiler data structures What is the Uniform Symbol Table in a compiler front end?

Difficulty: Easy

Correct Answer: A list of tokens, in full or in part, as they appear in the program; created by lexical analysis and used by syntax analysis and later stages.

Explanation:


Introduction / Context:
Compilers maintain several tables during analysis: the uniform symbol table (UST), literal table, identifier table, and terminal table. Distinguishing these helps clarify the roles of lexical and syntax analysis.



Given Data / Assumptions:

  • Lexical analysis recognizes tokens and records them for parsing.
  • Different tables hold different categories of information (tokens, literals, identifiers, terminals).
  • Uniform symbol table typically provides a uniform representation for tokens passed to the parser.


Concept / Approach:

The UST is the stream or structure of uniform symbols (tokens) produced by the scanner. Each entry commonly references supporting tables (identifier, literal) and encodes token class plus attributes. The parser consumes the UST to build syntax structures.



Step-by-Step Solution:

Identify which option describes a token sequence produced by lexical analysis.Option c explicitly states that the list is created by lexical analysis and used for syntax/interpretation.Map other options to their correct tables: literals (a), grammar rules or parse tables (b), terminals/keywords (d).Select option c for the UST.


Verification / Alternative check:

Compiler construction texts depict the interface between scanner and parser as a sequence of uniform symbols—precisely the UST concept.



Why Other Options Are Wrong:

a: That is the literal table. b: Refers to parsing tables/grammar; not the UST. d: Describes the terminal table.



Common Pitfalls:

Confusing the UST with a symbol table of identifiers only; the UST is a generalized token stream referencing other tables as needed.



Final Answer:

A list of tokens, in full or in part, as they appear in the program; created by lexical analysis and used by syntax analysis and later stages.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion