Representing scope information is a concept in which the scope of each variable name is preserved in the symbol table so that we can use the same name in different blocks and different locations.
Representing Scope Information involves
Representing Scope Information in FORTRAN
Consider a hashing scheme, as shown below −
In each chain, names that are external to the current routine will appear first.
It can append new internal names to the end and new external names to the beginning.
It is clear from the above diagram hash value has selected name 2, and hence 2 iscpart of the current routine, and Name 1 is external to it, that’s why Name 1 is written in the beginning and Name 2 is appended at the end.
When we reach the end of the routine and generate object code for it, we reset the pointer to available storage in the reusable table but not a permanent one.
All pointer that is from the permanent table to the reusable table is set to nill, and the hash table will directly point to the reusable table.
We can also reuse the storage space used for names in the following way. We will use location in name link storage areas to represent the name, and such a location can describe different routines since that area is reused.