Difficulty: Easy
Correct Answer: syntax analysis
Explanation:
Introduction / Context:The front end of a compiler typically consists of lexical analysis, syntax analysis (parsing), and semantic analysis. Understanding which phase groups tokens into grammatical structures is critical for designing grammars and parser generators.
Given Data / Assumptions:
Concept / Approach:Lexical analysis classifies character sequences into tokens. Syntax analysis (parsing) takes those tokens and assembles them into syntactic constructs (expressions, statements, declarations) according to context-free grammar rules. The output is typically a parse tree or abstract syntax tree used by later phases.
Step-by-Step Solution:
Distinguish phases: lexing (characters → tokens) vs. parsing (tokens → grammar structures).Identify the operation “parsing into syntactic classes” as the parser’s job.Select “syntax analysis.”Eliminate alternatives that describe other or nonstandard phases.Verification / Alternative check:Compiler textbooks and tools (Yacc/Bison/ANTLR) explicitly label this phase syntax analysis.
Why Other Options Are Wrong:Lexical analysis: tokenization, not parsing. “Interpretation analysis” and “general syntax analysis” are not standard phase names; the precise term is syntax analysis.
Common Pitfalls:Using “parsing” to mean tokenization; they are separate steps with different formalisms (regular vs. context-free languages).
Final Answer:syntax analysis
Discussion & Comments