Why Intermediate Representation

Types of Intermediate Representation

Directed Acyclic Graph (DAG)

A syntax tree with more than one path from the start symbol to the terminal is called DAG.

Untitled

Three Address Code (TAC)

A three-address code is a linearized representation of a syntax tree or a DAG in which explicit names correspond to the interior nodes of the graph.

A DAG and its corresponding three-address code

Untitled

Three-Address Code Various Statements

Untitled

Implementation of Three Address Code

IR is implemented in a data structure as objects with fields for their operators and operands.

Commonly used data structures are