GATE / CS ARCHIVE

GATE CSE 2023 / QUESTION 11

GATE CSE 2023 Q11

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 2023 paper

GATE 2023, Q11 1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 11, GATE 2023: Assess compiler statements S1: front-end phases are target-hardware independent; S2: back-end phases are target-hardware specific; S3: back-end phases are specific to the source programming language. A S1 only; B S1,S2; C all; D S1,S3.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The front end analyzes the source language and produces a target-independent representation, making S1 true. The back end maps that representation to the target instruction set and hardware, making S2 true. Source-language-specific analysis is normally a front-end responsibility rather than a back-end phase, so S3 is false. Thus B.

Teaching detail. Lexical analysis, parsing, and semantic/type analysis must understand source-language rules, but need not know the final processor's register set. Conversely, instruction selection, register allocation, and machine-code generation depend on the target. An intermediate representation is the interface separating these responsibilities. Particular compilers may mix optimizations across this boundary, but the question concerns the standard conceptual division; source-language semantics do not become a back-end-specific phase merely because the back end receives their translated representation.

Original paper, page 8 · Answer key