Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I want 2 know hv i solved the below example correctly?plz check it. Write the co

ID: 3632097 • Letter: I

Question

I want 2 know hv i solved the below example correctly?plz check it.


Write the code to implement the expression A = (B+C) * (D + E) for

1) 3-address machines
2) 2-address machines
3) 1-address machines
4) 0-address machines

Solution:
Let B+C = M
And D+E = N
Writing code to implement the given expression i.e. A = (B+C) * (D + E)

3-Address 0-Address
add M,B,C
add N,D,E
mul A,M,N
2-Address
load M,B
add M,C
load N,D
add N,E
mul N,M
store A,M
1-Address
lda B
adda C
sta M
lda D
adda E
sta N
mula M
sta A
0-Address
push B
push C
add
push D
push E
add
mul
pop A


Explanation / Answer

           ADD A, B, C

           ADD B, D, E

         Load A, B

          ADD A, C

         STORE C,A

         LOAD A,D

          ADD A,E

          LOAD B

           ADD C

          LOAD D

           ADD E

           MUL

          PUSH B

          PUSH C

          ADD

         PUSH D

         PUSH E

         ADD

         MUL

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote