Compiler design – permanent vs. transient tables In the general model of a compiler, which of the following is a permanent database (i.e., not rebuilt for each compilation)?
-
ALiteral Table
-
BIdentifier Table
-
CTerminal Table
-
DSource code
-
ENone of the above
Answer
Correct Answer: Terminal Table
Explanation
Introduction / Context:Compilers maintain a variety of tables while translating source code. Some are permanent parts of the compiler's definition of a language, whereas others are created afresh for each compilation unit.
Given Data / Assumptions:
- Literal and identifier tables are populated from the current program.
- Source code is input, not a compiler database.
- The terminal table lists the language’s tokens (keywords, operators, punctuation).
Concept / Approach:
The terminal table is a permanent specification of the language's alphabet (token types) known to the compiler. In contrast, the identifier table (symbol table entries for user-defined names) and literal table (constants found in the program) are transient and rebuilt for each compilation.
Step-by-Step Solution:
Classify each option: terminals (language-defined) vs program-specific data (identifiers, literals).Identify permanence: terminal set is fixed for the language and resides with the compiler.Pick “Terminal Table.”Verification / Alternative check:
Compiler textbooks describe lexical analysis using a DFA over the terminal set; the definition of terminals is part of the language specification and persists across compilations.
Why Other Options Are Wrong:
Literal/identifier tables are populated per source file or per build; source code is not a compiler database. Therefore, only the terminal table fits the “permanent” description.
Common Pitfalls:
Confusing the symbol table (which can be persisted by IDEs) with the permanent language tables inside the compiler; overlooking reserved word tables as part of terminals.
Final Answer:
Terminal Table.