Which data structure in a compiler is used for managing information about variables and their attributes?
View worked solution
Answer: B
The correct option is B.
Explanation:
- Symbol Table: This is a central data structure used by a compiler to store and manage information about various identifiers (such as variables, functions, and classes) along with their associated attributes like data type, scope, and memory offset.
- Abstract Syntax Tree (AST): A hierarchical tree representation of the abstract syntactic structure of the source code, primarily used for semantic analysis and intermediate code generation.
- Semantic Stack: A stack used during syntax-directed translation (typically in bottom-up parsing) to evaluate and propagate semantic values of grammar symbols.
- Parse Table: A tabular structure used by syntax analyzers (like LL or LR parsers) to decide which grammar production rule to apply next.
Free practice · Your answers on this page are not saved.
