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.
Fig: Triples field
Example:
Three address code is as follows:
t1 := -b t2 := c + dM t3 := t1 * t2 a := t3
These statements are represented by triples as follows:
Operator | Source 1 | Source 2 | |
---|---|---|---|
(0) | uminus | b | - |
(1) | + | c | d |
(2) | * | (0) | (1) |
(3) | := | (2) | - |
0 Comments