Question: Consider the following C program: The identifier x is declared in the methods outer scope. Another declaration occurs within the nested scope that assigns y.
Consider the following C program:
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
int func int x, y; x 10 int x; x 20 return (x y)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
