First time here? Checkout the FAQ!
+8 votes
Write $3$ address intermediate code (quadruples) for the following boolean expression in the sequence as it would be generated by a compiler. Partial evaluation of boolean expressions is not permitted. Assume the usual rules of precedence of the operators.

$$(a+b) > (c+d) \text{ or } a > c \text{ and }b < d$$
asked in Compiler Design by Veteran (79.1k points)   | 240 views

1 Answer

+15 votes
Best answer

Each instruction in quadruples presentation is divided into four fields: operator, arg1, arg2, and result. The above example is represented below in quadruples format:

(a+b)>(c+d)OR a>c AND b<d

(t1>t2)OR a>c AND b<d

t3 OR t4 AND t5

t3 OR t6


t1= a+b

t2= c+d

t3= t1>t2

t4= a>c

t5= b<d

t6= t4 AND t5

t7 =t3 OR t6

Op arg1 arg2 Result
+ a b t1
+ c d t2
> t1 t2 t3
.> a c t4
< b d t5
AND t4 t5 t6
OR t3 t6 t7


answered by Veteran (42.5k points)  
selected by

Top Users Aug 2017
  1. Bikram

    4902 Points


    4704 Points

  3. akash.dinkar12

    3480 Points

  4. rahul sharma 5

    3158 Points

  5. manu00x

    3012 Points

  6. makhdoom ghaya

    2470 Points

  7. just_bhavana

    2388 Points

  8. stblue

    2138 Points

  9. Tesla!

    2060 Points

  10. joshi_nitish

    1758 Points

25,014 questions
32,139 answers
30,185 users