GATE CSE
First time here? Checkout the FAQ!
x
+9 votes
204 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 (76.3k points)   | 204 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.5k points)  
selected by


Top Users Apr 2017
  1. akash.dinkar12

    3660 Points

  2. Divya Bharti

    2580 Points

  3. Deepthi_ts

    2040 Points

  4. rude

    1966 Points

  5. Tesla!

    1768 Points

  6. Debashish Deka

    1614 Points

  7. Shubham Sharma 2

    1610 Points

  8. Prashant.

    1492 Points

  9. Arjun

    1472 Points

  10. Arunav Khare

    1464 Points

Monthly Topper: Rs. 500 gift card

22,088 questions
28,063 answers
63,298 comments
24,173 users