Compiler tables and definitions: In the context of a language processor, what is a Terminal Table typically defined as?
-
Acontains all constants in the program
-
Ba permanent table of decision rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure.
-
Cconsists of a full or partial list of the tokens as they appear in the program; created by lexical analysis and used for syntax analysis and interpretation
-
Da permanent table which lists all key words and special symbols of the language in symbolic form.
-
ENone of the above
Answer
Correct Answer: a permanent table which lists all key words and special symbols of the language in symbolic form.
Explanation
Introduction / Context:Language translators use several auxiliary tables to manage symbols and grammar elements. Knowing the purpose of each—terminal, identifier, and literal tables—clarifies how compilers parse and analyze source code.
Given Data / Assumptions:
- “Terminals” are the basic symbols of the grammar: keywords, operators, and punctuation.
- Lexical analysis classifies input into tokens.
- Permanent tables differ from per-program symbol or literal tables.
Concept / Approach:The Terminal Table is a permanent catalog of the language’s terminal symbols—keywords and special symbols—typically fixed for a language definition. In contrast, a Literal Table stores constants encountered in a program, and an Identifier Table lists user-defined names. Parsing tables (decision tables) are separate automaton artifacts used during syntax analysis.
Step-by-Step Solution:
Identify what belongs in a permanent, language-wide list: keywords and special symbols.Exclude program-specific entities (identifiers, literals).Exclude parser decision structures that are not “terminal tables.”Select the definition that matches: a permanent table listing keywords and special symbols.Verification / Alternative check:Compiler design texts separate terminal/identifier/literal tables clearly; lexer uses the terminal table to recognize keywords and operators.
Why Other Options Are Wrong:Constants only: describes a literal table. Decision rules/patterns: describes parsing tables, not terminals. Token list as they appear: describes a token stream or symbol table for a specific program.
Common Pitfalls:Confusing the general language dictionary (terminals) with a program’s symbol inventory (identifiers and literals).
Final Answer:a permanent table which lists all key words and special symbols of the language in symbolic form.