Construct Quadruples, Triples, and Indirect Triples for the expression
-(a + b) * (c + d) - (a + b + c)


First of all this statement will be converted into Three Address Code as−

t1 = a + b

t2 = −t1

t3 = c + d

t4 = t2 ∗ t3

t5 = t1 + c

t6 = t4 − t5


LocationOperatorarg 1arg 2Result


LocationOperatorarg 1arg 2

Array Representation

Quadruple is a structure that contains atmost four fields, i.e., operator, Argument 1, Argument 2, and Result. The triples have three fields to represent the three address codes. The field of triples includes the name of the operator, the first source operand, and the second source operand.

This three address code representation contains three (3) fields, i.e., one for operator and two for arguments (i.e., Argument 1 and Argument 2). In this representation, temporary variables are not used. Instead of temporary variables, we use a number in parenthesis to represent a pointer to that particular record of the symbol table.

Quadruples & triples cause some wastage of memory because some fields are not occupied. To prevent wastage of space, the expression can be represented in a single array.

Example− Consider a statement

a = −b + c ∗ d

Its Three Address Code will be

t1 = −b

t2 = c ∗ d

t3 = t1 + t2

a = t3

Quadruples will be

LocationOperatorarg 1arg 2Result

Since there is wastage of space in the Quadruple, so it can be converted into Array Representation as



  • It saves memory space.


  • It cannot recognize a word, i.e., whether it is an operator or an operand. In Quadruple, it can be quickly done as operators & operands are written in their corresponding fields.

Updated on: 05-Nov-2021

26K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started