Header Ads Widget

Triples

Triples

The triples have three fields to implement the three address code. The field of triples contains the name of the operator, the first source operand and the second source operand.

In triples, the results of respective sub-expressions are denoted by the position of expression. Triple is equivalent to DAG while representing expressions.

Triples

          Fig: Triples field

Example:

  1. a := -b * c + d  

Three address code is as follows:

t1 := -b t2 := c + dM t3 := t1 * t2 a := t3

These statements are represented by triples as follows:

OperatorSource 1Source 2
(0)uminusb-
(1)+cd
(2)*(0)(1)
(3):=(2)-

Post a Comment

0 Comments