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 name in symbol table along with an indicator of the block in which it appears.
Suppose we have a variable name 'a' in block A and the same variable in block B. Suppose it can store 'a' in the symbol table without block information. In that case, it will only keep the first instance of 'a' which it encounters, hence to overcome this problem names are stored in the form of pair (variable name, block name) so that the same name can be used in different blocks and procedures.
There are two ways of representing scope information which is as follows −
Scope Representation by Number
It stores all values in one Symbol Table.
The same name can be declared many times as a distinct name in different blocks or procedures.
So, each Procedure or block can be given a unique number.
Symbol Table will not contain just the name of the identifier, but each entry will have a pair (name, procedure-number).
We can recognize the particular identifier in a procedure by matching not only the name of the identifier but also match the procedure number to which it belongs.
Each block or procedure will be assigned a number.
The following shows the configuration of Symbol Table, i.e., fill identifiers with their corresponding procedure or block no.
Here, the identifier or name will belong to the most closely nested of active subprograms declaring that identifier or procedure.