In the context of compilers, which of the following is/are an intermediate representation of the source program?
View worked solution
Answer: D
An Intermediate Representation (IR) is a machine-independent representation of the source code used by a compiler between the front-end (analysis) and back-end (synthesis) phases.
Let's analyze the given options:
- Three-address code (TAC): A linear intermediate representation where each instruction has at most three operands. Hence, it is an IR.
- Abstract Syntax Tree (AST): A hierarchical, tree-based intermediate representation that represents the structural syntax of the source code. Hence, it is an IR.
- Control Flow Graph (CFG): A graph-based representation of all paths that might be traversed through a program during its execution. It is widely used as a low-level IR for optimization.
- Symbol Table: A data structure used to store information about identifiers (such as variables, functions, and classes) along with their types, scope, and memory locations. It is an auxiliary data structure used throughout the compilation process, not an intermediate representation of the source program itself.
Therefore, the Symbol table is NOT an intermediate representation.
Free practice · Your answers on this page are not saved.
