- 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 are Lists and Self-Organizing lists in compiler design?
- It is conceptually simplest and easy to implement a data structure for the symbol table in a linear list of records, as shown below −
- It can use an individual array to store the name and its associated information. New Names are inserted to the list in the order in which they are encountered. It can retrieve data about a name we search from the starting of the array up to the position marked by the pointer AVAILABLE which indicates the beginning of the empty portion of the array.
- When the name is placed, the associated data can be discovered in the words following next. If we reach available without identifying the name, it can fault in the use of an undefined name.
- It can insert n names and m inquires the total work is c(n+m) where c is constant representing the time necessary for new machine operations.It can insert n names and m inquires the total work is c(n+m) where c is constant representing the time necessary for new machine operations.
Some fact about list data structure
- Work essential to add a new name is proportional to n, where the symbol table contains n names.
- Cost of searching a name in the list is proportional to n/2.
- To insert n names and m enquiries, total work is
cn (n + m) where c is constant
- It is used to minimum space requirement.
- It is easy to understand & implement.
- It is used for sequential access
- The amount of work done needed to be done is high.
At the cost of a little extra space, it can use a trick that will save a substantial fraction of the time spent in searching the symbol table. It can add a LINK field to each record, and we search the list in the order indicated by LINK’s. The figure shows an example of four name symbol table.
FIRST, give the position of the first record on the linked list, and each LINK field denotes the next record on the list. When a name is referenced or its record is first created, it can move the record for that name to the front of the list by moving pointers.
This approach is used to decrease searching time in list organization. A special attribute link is added to the information of name that allows dynamic feature in the list, and this feature helps in minimizing wastage of spaces and also promotes reusability to some extent.
First Pointer points to the starting of the symbol table.
If we have names in the following order.
3 → 1 → 4 → 2
If we need a particular record, we need to move the record to the front of the list.
Suppose we need 4 so, new connections will be
4 → 3 → 1 → 2
- It can increase search efficiency.
- It can promote reusability to some extent.
- It can difficult to maintain so many links and connections.
- It can extra space requirement is there.
- Related Articles
- C++ Program to Perform Searching Using Self-Organizing Lists
- What are Parsing Techniques in Compiler Design?
- What are Precedence Functions in compiler design?
- What is Compiler Design?
- What are Add, Remove methods in C# lists?
- What are the specifications and operations of data structures in compiler design?
- What is Design of Lexical Analysis in Compiler Design?
- What are the attributes of programming languages in compiler design?
- What are the types of the translator in compiler design?
- What are the operations on sequential files in compiler design?
- What are the Rules of Regular Expressions in Compiler Design?
- What are the differences and similarities between tuples and lists in Python?
- What is binding and binding time in compiler design?
- What is Chomsky Hierarchy in compiler design?
- What is error handling in compiler design?