Compiler tables: in the context of language processing, what does the Terminal Table contain and how is it used during compilation?

Difficulty: Easy

Correct Answer: a permanent table which lists all key words and special symbols of the language in symbolic form

Explanation:


Introduction / Context:
Compilers maintain several tables to speed up and standardize processing. A “terminal” in grammar terms is a basic symbol of the language (e.g., keyword, operator, delimiter). The Terminal Table provides canonical representations of these terminals so scanners and parsers can recognize and process them consistently.


Given Data / Assumptions:

  • Language has reserved keywords (e.g., IF, WHILE) and special symbols (+, :=, ;, etc.).
  • Compiler separates concerns among terminal tables, token streams, and parse tables.
  • We aim to identify the proper definition of a Terminal Table.


Concept / Approach:
The Terminal Table enumerates the set of terminals with their symbolic forms and possibly attributes (token codes, precedence). It differs from the token (uniform symbol) list produced per-program by lexical analysis, and from parse decision tables used by the parser. It also differs from constant tables, which hold numeric/string literals found in the user’s program.


Step-by-Step Solution:
1) Distinguish global language metadata (terminals) from program-specific data (tokens, constants).2) Recognize that terminals are keywords and special symbols defined by the language.3) Conclude the Terminal Table is the permanent listing of these items in symbolic form.


Verification / Alternative check:
Compiler textbooks depict terminal tables or keyword tables used by the scanner to map lexemes to token kinds, confirming this definition.


Why Other Options Are Wrong:

  • Decision rules/patterns: That describes parse tables, not terminals listing.
  • Tokens list: Program-specific output of lexical analysis, not a permanent table of terminals.
  • All constants: That is a constant/literal table, not terminals.


Common Pitfalls:
Assuming terminals equal tokens. Tokens are instances recognized in a given compilation; terminals define the language’s alphabet.


Final Answer:
a permanent table which lists all key words and special symbols of the language in symbolic form.

More Questions from Language Processors

Discussion & Comments

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