GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 1.12

Purpose of an intermediate representation

Compiler Design · Intermediate Code · Full GATE CSE 1994 paper

GATE 1994, Q1.12 MCQ
Report issue

Intermediate Code

Question 1.12, GATE 1994: Why generate intermediate code for an abstract machine: easier lexing, availability of syntax-directed rules, frontend portability, or inability to generate real machine code directly?
Tap to enlarge
Your answer
Answer & solution

Answer: C: frontend portability (no official key was published)

An intermediate representation separates language analysis from target-machine details. The same frontend can translate a source language into that representation, while different backends generate code for different processors. This improves portability and reuse. Direct generation of machine code is possible, so D is false. Syntax-directed translation can generate an IR, but its existence is not the main abstract-machine benefit, and lexical analysis does not become fundamentally easier merely because an IR is chosen.

Original paper, page 2