Question: 2 ) You designed and implemented the DC ( Dynamic C ) , which is a new programming language with dynamic scoping. Consider the following
You designed and implemented the DC Dynamic C which is a new programming language with dynamic scoping. Consider the following code that can be run on both DC and C without any modification.
#include
int i ; int j
; int k ;
void hvoid
printf H: d
i;
iijk; Program point
printf H: d
i;
void gvoid
int k ;
printf G: d
i;
iijk; Program point
h;
printf G: d
i;
void fvoid
int j ;
printf F: d
i;
iijk; Program point
g;
printf F: d
i;
void main void
int i ;
printf M: d
i;
f;
printf M: d
i;
g;
printf M: d
i;
h; Program point
printf M: d
i;
aWhat is the output, when the code is compiled with the mathbfC compiler? Give the referencing environments at program points and
b What is the output, when the code is compiled with the new DC compiler? Give the referencing environments at program points and for each invocation of the corresponding function. Note that the referencing environment at each invocation might be totally different for the same program point.
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
