Compare zero-, one, two-, and three- address machines by writing programs to compute
X = (A + B x C)/(D - E x F)
for every of the four machines. Do not modify the values of A, B, C, D, E, or F. If essential, use a temporary location T to kept the intermediate results.
The instructions available for use are as follows:
0 Address
|
1 Address
|
2 Address
|
3 Address
|
PUSH M
|
LOAD M
|
MOVE (XßY)
|
MOVE (XßY)
|
POP M
|
STORE M
|
ADD (XßX + Y)
|
ADD (XßY + Z)
|
ADD
|
ADD M
|
SUB (XßX - Y)
|
SUB (XßY - Z)
|
SUB
|
SUB M
|
MUL (XßX x Y)
|
MUL (XßY x Z)
|
MUL
|
MUL M
|
DIV (XßX / Y)
|
DIV (XßY / Z)
|
DIV
|
DIV M
|
|
|