Question: 9 . - [ Stack mechanism and code generation ] ( 1 1 points ) . Consider the program described below and give the generated

9.-[Stack mechanism and code generation](11 points). Consider the program described below
and give the generated code for the statements at 1,2, and 3. Procedures are called as shown
below.
BIGSUB calls SUB2
SUB2 calls SUB3
SUB3 calls SUB1
(Assume the ARs have SL, DL, and RA. If errors occur, indicate where it is detected and what is
the cause of the error.
procedure BIGSUB;
var A, B, C : integer;
procedure SUB1;
var A, K : integer;
begin { SUB1}
B := C + A; <-----------------------1
end; { SUB1}
procedure SUB2(X : integer);
var B, F, E : integer;
procedure SUB3;
var C, K, E : integer;
begin { SUB3}
SUB1;
K := B * E; <--------------------2
end; { SUB3}
begin { SUB2}
SUB3;
K := E + A; <-----------------------3
end; { SUB2}
begin { BIGSUB }
SUB2(9);
end; { BIGSUB }

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 Databases Questions!