How to answer these questions?
. These issues are part of semantic analysis phase
. Answers to these questions depend upon values like type information, number of parameters etc.
. Compiler will have to do some computation to arrive at answers
. The information required by computations may be non local in some cases
In order to answer the previous questions the compiler will have to keep information about the type of variables, number of parameters in a particular function etc. It will have to do some sort of computation in order to gain this information. Most compilers keep a structure called symbol table to store this information.
At times the information required is not available locally, but in a different scope altogether.
|