In the context of compilers, which of the following is/are NOT an intermediate…

2021

In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?

  1. A.

    Three address code

  2. B.

    Abstract Syntax Tree (AST)

  3. C.

    Control Flow Graph (CFG)

  4. D.

    Symbol table

Attempted by 117 students.

Show answer & explanation

Correct answer: D

Answer: Symbol table is not an intermediate representation of the source program.

Why the other items are intermediate representations:

  • Three address code: a linearized IR composed of simple instructions (typically with up to three operands) used for optimizations and as input to target code generation.

  • Abstract Syntax Tree (AST): a tree-structured representation of the parsed program that captures syntactic structure and is used for semantic analysis and transformations.

  • Control Flow Graph (CFG): a graph representation of basic blocks and control flow edges used for analyses and optimizations; it models program execution flow and is treated as an IR for many compiler passes.

Why the symbol table is not an intermediate representation:

The symbol table is a supporting data structure that stores metadata about identifiers (names), scopes, types, and attributes needed during parsing, semantic analysis, and code generation. It does not represent the program's code, control flow, or data flow in a form suitable for optimization, so it is not classified as an intermediate representation.

Therefore, the symbol table is correctly identified as NOT an intermediate representation.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir