Question: Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main { proc A: { proc B; { int x
Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main proc A: proc B; int x a; x :; a:; call C; print x; end B proc C; int z; x :; z :; print a; end C int a; x :; z :; a:; call B; print x; end A proc D; proc E; int x z; x :; z:; call F; print x; end E proc F; proc G; print z; x:; call A; print x; end G print x; call G; x:; end F int x b; x :; call E; print x; end D int x z; x:; z :; call D; print x; end mainapts What is the program output assuming static scoping rules are employed? bpts What is the corresponding output when dynamic scoping rules are employed? cpts List all of the units procs that proc C can call assuming static scopingdpts Specify the referencing environment of proc F assuming static scoping That is list the variables that are visible to proc F epts Specify the referencing environment of proc F assuming dynamic scoping That is list the variables that are visible to proc F Consider the following program:
In each case YOU MUST SHOW ALL OF YOUR WORK
proc main
proc A:
proc B;
int x a;
x:
a:;
call C;
print x;
end B
proc C;
int z;
x:;
z:;
print a;
end C
int a;
x:;
z:;
a:;
call B;
print x;
end A
proc D;
proc E;
int x z;
x:;
z:;
call F;
print x;
end E
proc F;
proc G;
print z;
x:;
call A;
print x;
end G
print x;
call G;
x:;
end F
int x b;
x:;
call E;
print x;
end D
int x z;
x:;
z :;
call D;
print x;
end main
apts What is the program output assuming static scoping rules are employed?
bpts What is the corresponding output when dynamic scoping rules are employed?
cpts List all of the units procs that proc C can call assuming static scoping
dpts Specify the referencing environment of proc F assuming static scoping That is list the variables that are visible to proc F
epts Specify the referencing environment of proc F assuming dynamic scoping That is list the variables that are visible to proc F
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
