Difficulty: Easy
Correct Answer: to recognize the major constructs of the language and to call the appropriate action routines that will generate the intermediate form or matrix for these constructs.
Explanation:
Introduction / Context:
Compilers operate in phases. After lexical analysis produces tokens, the syntax phase (parsing) organizes tokens into grammatical structures, ensuring the program conforms to the language grammar and producing an intermediate representation for later stages.
Given Data / Assumptions:
Concept / Approach:
The syntax phase recognizes constructs such as expressions, statements, and declarations. It constructs a parse tree or abstract syntax tree and triggers semantic or IR-building actions. Building identifier/literal tables and tokenization are tasks of the lexical phase, not the syntax phase.
Step-by-Step Solution:
Verification / Alternative check:
Standard compiler pipelines show: Lexing → Parsing → Semantic analysis → IR → Optimization → Code generation. Parsing is where grammatical structure is enforced.
Why Other Options Are Wrong:
(b) and (c) correspond to symbol/literal table construction typically driven by the lexer and semantic phases; (d) describes lexical tokenization rather than parsing.
Common Pitfalls:
Conflating tokenization with parsing; assuming symbol tables are fully built before syntax checks (they evolve across phases).
Final Answer:
to recognize the major constructs of the language and to call the appropriate action routines that will generate the intermediate form or matrix for these constructs.
Discussion & Comments