The GATE Grind

GATE 2014 CS (CS3) – Question 27

Compiler Design · Intermediate Code Generation · 1 mark · Multiple choice

One purpose of intermediate code in compilers is to ______.

  1. make parsing and semantic analysis simpler
  2. improve error recovery and reporting
  3. increase opportunities to reuse the machine-independent code optimizer in other compilers
  4. improve register allocation

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) increase opportunities to reuse the machine-independent code optimizer in other compilers

Explanation

A machine-independent intermediate representation separates source-language translation from target-specific code generation. Optimisations on that representation can be reused across compilers. Thus **C**. It does not inherently simplify the source grammar or guarantee better register allocation.