Difficulty: Easy
Correct Answer: recognition of basic syntactic constructs through reductions.
Explanation:
Introduction / Context:
Compilers proceed through distinct phases: lexical analysis, syntax analysis, semantic analysis, optimization, and code generation. The question focuses on what happens during syntax analysis (parsing) for a PL/I program, but the principle applies broadly to many languages.
Given Data / Assumptions:
Concept / Approach:
Syntax analysis verifies that the token sequence adheres to the language grammar and builds a parse tree or abstract syntax tree. In bottom-up parsers (e.g., LR), reductions repeatedly replace sequences of tokens/nonterminals with a higher-level nonterminal until the start symbol is reached, recognizing syntactic constructs.
Step-by-Step Solution:
Verification / Alternative check:
Compiler texts define parsing as grammar-constrained recognition; reductions are a hallmark of shift-reduce parsers.
Why Other Options Are Wrong:
Basic elements and uniform symbols: lexical analysis, not syntax. Optional/optimal matrix: unclear and not standard terminology. Macro processor/optimal assembly: relates to macro expansion or later stages.
Common Pitfalls:
Mixing up lexing and parsing; interpreting “reductions” as optimization (it is a parsing action).
Final Answer:
recognition of basic syntactic constructs through reductions.
Discussion & Comments