Skip to main content

GATE CSE 2023Compiler Design › Lexical Analysis, Compilation Phases & LinkingVerified

GATE CSE 2023 PYQ: Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end…

Consider the following statements regarding the front-end and back-end of a compiler.

S1: The front-end includes phases that are independent of the target hardware.
S2: The back-end includes phases that are specific to the target hardware.
S3: The back-end includes phases that are specific to the programming language used in the source code.

Identify the CORRECT option.

  1. A
    Only S1\mathbf{S 1} is TRUE.
  2. B
    Only S1\mathbf{S 1} and S2\mathbf{S 2} are TRUE.
    Correct answer
  3. C
    S1,S2\mathbf{S 1}, \mathbf{S 2}, and S3\mathbf{S 3} are all TRUE.
  4. D
    Only S1\mathbf{S 1} and S3\mathbf{S 3} are TRUE.

Answer

(B) Only S 1 \mathbf{S 1} S1 and S 2 \mathbf{S 2} S2 are TRUE.

Approach

Recall the standard two-part decomposition of a compiler into a machine-independent front end and a machine-dependent back end. Test each statement against that boundary: the front end analyses the source and emits an intermediate representation, while the back end transforms that representation into code for a specific target machine.

A compiler's front end is language-dependent but hardware-independent (S1 true), and its back end is hardware-dependent but language-independent (S2 true, S3 false). Therefore only S1 and S2 are correct, giving option B.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.