357 views

1 Answer

0 votes
0 votes

Q5. Implement a+b*(c+d)-e/f

into: 

a). Quadruples.

b). Triples.

c). Indirect triples.

answer:

Three Address Code:

t1=a+b

t2=c+d

t3=t1*t2

t4=e/f

t5=t3-t4

  1. Quadruples:

 

location

OP

ARG1

ARG2

Result

0

+

a

b

t1

1

+

c

d

t2

2

*

t1

t2

t3

3

/

e

f

t4

4

+

t3

t4

t5

  1. Triples:

 location

OP

ARG1

ARG2

(0)

+

a

b

(1)

+

c

d

(2)

*

(1)

(2)

(3)

/

e

f

(4)

+

(3)

(4)

 

  1. Indirect triples.                                                                                                               

 

statement

35

(0)

36

(1)

37

(2)

38

(3)

39

(4)

 

 

edited by

Related questions

129
views
0 answers
0 votes
Ebrahim asked May 5
129 views
Q4. Generate target code for the following source language statements : x = a + b + c * (d-e) 
93
views
0 answers
0 votes
Ebrahim asked May 5
93 views
Q2. Implement the statement a:= -b + c*(d-e) + f * (c*(d-e)) into following Intermediate code representation.  a) Quadrupleb) Triple c) Indirect Triple Solve the above Question like this example
269
views
1 answers
0 votes
Ebrahim asked Jan 12
269 views
Q1. For the following grammar N -> AB | BA A -> a | CAC B -> b | CBC C -> a | b Find the FIRST and FOLLOW
384
views
1 answers
0 votes
Ebrahim asked Dec 18, 2023
384 views
Please Answer this question 4. Discuss design issues in code generation. Generate target code for the following basic block. t1 : = a + b t2 : = c + d t3 : = e - t2 t4 : = t1 - t3