Translate the expression -
-(a+b)*(c+d)+(a+b+c) into (ii) Quadruples
At first we construct the three address code the above expression :
Three address code :
0) T1 : = a+b
1) T2 : = -T1
2) T3 : = c+d
3) T4 : = T2*T3
4) T5 : = a+b
5) T6 : = T5+c
6) T7 : = T4+T6
-(a+b)*(c+d)+(a+b+c) into (ii) Quadruples
At first we construct the three address code the above expression :
Three address code :
0) T1 : = a+b
1) T2 : = -T1
2) T3 : = c+d
3) T4 : = T2*T3
4) T5 : = a+b
5) T6 : = T5+c
6) T7 : = T4+T6
SL NO | OP | ARG1 | ARG2 | RESULT |
---|---|---|---|---|
(0) | + | a | b | T1 |
(1) | uminus | T1 | - | T2 |
(2) | + | c | d | T3 |
(3) | * | T2 | T3 | T4 |
(4) | + | a | b | T5 |
(5) | + | T5 | c | T6 |
(6) | + | T4 | T6 | T7 |
Fig. (a) quadruple.
0 comments:
Post a Comment