Question: Show the activation stack with all activation record instances, including static and dynamic links, when execution reaches Line # 1 9 ( write ( z

Show the activation stack with all activation record instances, including static and dynamic links, when execution reaches Line #19(write(z);). Assume the activation stack begins at address 50, integers occupy two locations, addresses one location in memory, and the parameters are passed by value. Show your answer in 3 columns, Address, value, and explanation (describe rows meaning like what it is like main.result, A.staticLink, A.dynamicLink etc)
program main;
var result : integer;
procedure A (x : integer);
var aaa : integer;
procedure B (y : integer, j : integer);
begin (b)
j := y +5
C(j +2);
end (B);
begin (A)
x := x -2;
aaa :=3;
B (aaa, x);
end (A)
procedure C(z : integer);
var m : integer;
begin (C)
result := z;
write (z);
m := z;
D(m);
end (C)
procedure D (x : integer);
begin (D)
x :=12;
end (D)
begin (main)
result :=9;
A(result);
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!