GATE CSE
First time here? Checkout the FAQ!
x
+9 votes
192 views
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 (76k points)   | 192 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 (41.1k points)  
selected by


Top Users Mar 2017
  1. rude

    4018 Points

  2. sh!va

    2994 Points

  3. Rahul Jain25

    2804 Points

  4. Kapil

    2608 Points

  5. Debashish Deka

    2104 Points

  6. 2018

    1414 Points

  7. Vignesh Sekar

    1336 Points

  8. Bikram

    1218 Points

  9. Akriti sood

    1186 Points

  10. Sanjay Sharma

    1016 Points

Monthly Topper: Rs. 500 gift card

21,446 questions
26,759 answers
60,943 comments
22,955 users