Question: Hi , What is the solution for this question? Could someone update me? Consider below C program: int func() { int x, y; x =
Hi ,
What is the solution for this question? Could someone update me?
Consider below C program:
int func() { int x, y;
x = 10;
{ int x;
x = 20;
y = x;
}
return(x * y);
}
The identifier x is declared in the methods outer scope. Another declaration occurs within the nested scope that assigns y. In C, the nested declaration of x could be regarded as a declaration of some other name, provided that the inner scopes reference to is appropriately renamed x.
Design a set of AST visitor methods that,
Renames and moves nested variable declarations to the methods outermost scope
Appropriately renames symbol references to preserve the meaning of the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
