Thursday, March 24, 2016

Translate the following assignment statement A : = -B*(C+D) into three address, quadruple & triple forms


Here, given the expression - A: = -B*(C+D)
Three-address code :    
T1 : = -B
T2 : = C+D
T3 : = T1+T2
A : = T3
These statement are represented by quadruples as shown in fig . (a) 

SL NO OP ARG1 ARG2 RESULT
(0) Uminus B - T1
(1) + C D T2
(2) * T1 T2 T3
(3) := T3 - A

Fig. (a) quadruple representation of three -address statements.


 These statement are represented by triples as shown in fig . (b) 


SL NO OP ARG1 ARG2
(0) Uminus B -
(1) + C D
(2) * (0) (1)
(3) := A (2)

Fig. (b) triple representation of three -address statements.

If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment