- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Types of Representative Scope Information?
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.
Scope Representation By Blocks or Locations
- It creates a separate table for each Scope Block or procedure.
- Multiple identifiers with the same name can easily be inserted because the same name variable will be shared in a separate block.
- We cannot have two variables with a similar name in the same block or procedure.
- Each procedure or subprogram will have a different table representation of its contents. When an identifier is searched, the proper table, i.e., subprogram or procedure number and identifier name will be matched.
- This method is more reliable and simpler to understand.
- Related Articles
- What is Representing Scope Information?
- What are the types of Information Security?
- Types of Information Systems
- What are the types of Network in Information Security?
- What are the types of firewalls in information security?
- What are the types of Authentication in information security?
- What are the types of Cryptosystems in information security?
- What are the types of Hashing in Information Security?
- What are the types of Keys in Information Security?
- What are the types of Encryption in Information Security?
- What are the types of Decryption in Information Security?
- What are the types of web services in information security?
- What are the types of memory card in information security?
- What are the types of security mechanism in information security?
- Variables, their types, and Scope in C++