Difficulty: Medium
Correct Answer: Assembly and output
Explanation:
Introduction / Context:
Compilers proceed through well-defined phases, from lexical and syntax analysis to code generation and assembly. Understanding which phase resolves symbolic labels and emits final machine code clarifies how human-readable names become concrete addresses.
Given Data / Assumptions:
Concept / Approach:
Code generation emits target instruction templates and symbolic references. The assembly/output stage then resolves remaining symbolic addresses (labels) and encodes final opcodes, displacements, and addresses, producing object code suitable for linking and loading. Storage assignment concerns layout of variables; syntax analysis builds parse trees but does not produce machine code.
Step-by-Step Solution:
Verification / Alternative check:
Toolchains often split codegen and assembly; many modern compilers still emit assembly or object with relocations resolved by an assembler/linker.
Why Other Options Are Wrong:
Code generation templates instructions but may not resolve all symbols. Storage assignment handles memory layout. Syntax analysis parses grammar only.
Common Pitfalls:
Conflating code generation with final address resolution; forgetting that link-time or assembly-time fixups complete the mapping.
Final Answer:
Assembly and output
Discussion & Comments