2. [15] The following program undergoes scope checking using a stack of symbol tables: 1. void main (int argc, char** argv, char** env) { 2. فی خانه نه 5. 6. int a, float b; if (argc >= 10) { int b; for (int argc = 1; argc < 10; argc++ ) { cout << argv [argc]; 7. 8. 9. } 10. } 11. else { 12. 3. } 4. } char* argv; (a) [5] Draw the symbol tables created for this program as follows: List in each symbol table all the identifiers in that scope as pairs (identifier,type). Then draw the links (pointers) between the symbol tables that establish the stack structure. duplicate (6) 19 Idely between the op larify your choice rated above and and (b) [5] Let the scope checking algorithm process line 8 of the program. Identify in your answer to the previous question the symbol table corresponding to the current scope as well as the symbol tables corresponding to all the open scopes. 5] Explain then how are the symbol tables inspected to obtain the type of the variable gv and argc on line 8.
2. [15] The following program undergoes scope checking using a stack of symbol tables: 1. void main (int argc, char** argv, char** env) { 2. فی خانه نه 5. 6. int a, float b; if (argc >= 10) { int b; for (int argc = 1; argc < 10; argc++ ) { cout << argv [argc]; 7. 8. 9. } 10. } 11. else { 12. 3. } 4. } char* argv; (a) [5] Draw the symbol tables created for this program as follows: List in each symbol table all the identifiers in that scope as pairs (identifier,type). Then draw the links (pointers) between the symbol tables that establish the stack structure. duplicate (6) 19 Idely between the op larify your choice rated above and and (b) [5] Let the scope checking algorithm process line 8 of the program. Identify in your answer to the previous question the symbol table corresponding to the current scope as well as the symbol tables corresponding to all the open scopes. 5] Explain then how are the symbol tables inspected to obtain the type of the variable gv and argc on line 8.
Question
Can you please give me the precise answers? Thanks
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images