Compiler phases (PL/I example): In the compilation process, the step described as “resolving symbolic addresses (labels) and generating machine language” corresponds to which phase?

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:

  • We are compiling a high-level language (PL/I) down to executable code.
  • Symbolic labels (procedure and branch targets) must be mapped to addresses.
  • Final machine instructions are emitted after address resolution.


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:

Recognize that “resolving labels” is traditionally an assembler function.Map “generating machine language” to the final emission step.Identify the combined phase as “assembly and output.”Exclude code generation alone, which may still reference symbols to be fixed later.


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

More Questions from Operating Systems Concepts

Discussion & Comments

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