1 / 22

Data Structure for Language Processing

Lecture by: Prof. Pooja Vaishnav. Data Structure for Language Processing. Data Structure for Language Processing. Language Processor implementations are highly influenced by the kind of storage structure used for program variables and data .

cfrierson
Download Presentation

Data Structure for Language Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture by: Prof. Pooja Vaishnav Data Structure for Language Processing

  2. Data Structure for Language Processing • Language Processor implementations are highly influenced by the kind of storage structure used for program variables and data. • Managing Language requires allocating and managing the memory used by the program in static or dynamic environments. • Implementation of suitable data structure becomes critical in designing and executing the system programs.

  3. Data Structure for Language Processing • The Program behavior depends on the search and allocation structures, the language support and their features such as external reference, recursion etc. • Vital operations: Search and Allocation

  4. Data Structure for Language Processing • Choice of Data Structure: • The design of runtime and storage management system is greatly influenced by the nature of source language. • The structure and composition of source language commands the requirements of the language processor, takes up the job of code generation and allocates memory for the program objects that have their own logical address space

  5. Data Structure for Language Processing • Choice of Data Structure: • Nature of Data Structure • Linear or non linear • Linear data structure involves linear data elements arrangements • Search efficiency is considered by requirement of contiguous memory allocations for the elements • Sometimes designer may compelled to overestimate the memory requirements of the linear data structure in order to ensure that later on memory requirements would not expand. • This often leads to wastage of memory. • Easy Access • Implemented as Arrays or Linked Lists

  6. Data Structure for Language Processing • Choice of Data Structure: • Nonlinear data structure are the alternatives • Uses pointer implementations to access elements • Need not occupy contiguous memory locations • More flexible in allocation and availability of space • Lower search efficiency • Interleaved memory locations

  7. Data Structure for Language Processing • Choice of Data Structure: • Purpose of Data Structure • Whether Search data structure or Allocation Data Structure • Search Data Structure: • Provides efficient search • Maintain attribute information • Include table and sequential organization, binary search organization, hash tables, linked lists, tree structure

  8. Data Structure for Language Processing • Choice of Data Structure: • Purpose of Data Structure • Whether Search data structure or Allocation Data Structure • Allocation Data Structure: • Include stack and heap organizations • Not required the search operation and address of the memory Language Processors uses both, search and allocation data structure.

  9. Data Structure for Language Processing • Choice of Data Structure: • Lifetime of Data Structure • Whether it is used during language process or the target program execution • For ex., a data structure used during a language process would have the scope till that process only.

  10. Search Data Structure • Also called as search structure • Designed and used for its search efficiency during language processing • Set of entries, with each encompassing the information concerning one entity • Maintains attribute information about different entities defined and used in the source program

  11. Search Data Structure • Entry will be done only once but can be searched many times • Primarily created to store table of information • Mainly created and used during analysis phase of program • Target program rarely use this data structure • Used for Symbol Table implementation

  12. Search Data Structure • Characterized by ‘key’, special symbol field containing name of entity to assist search operation

  13. Features: Search Data Structure • Entry: set of fields referred to as record • Entry contains two parts: • Value in fixed part determines the information to be stored in the variable part • Fixed (tag): Symbol, class type, length, dimension information, number of parameters, their addresses, type of returned value, length of returned value, statement number • Variable : name, class, statement number

  14. Features: Search Data Structure • Fixed length entry enable use of homogeneous linear data structures • eg. Arrays, they may contain records having identical format • Suffers from inefficient use of memory usage • Variable length entry leads to compact organization with no memory wastage

  15. Features: Search Data Structure

  16. Features: Search Data Structure • Combining the functionality of two: • Hybrid Entry Format:

  17. Symbol Table • Kind of data structure, which is used in language processing as both, search and allocation data structures

  18. Operations: Search Data Structure • Insert • Search • Delete

  19. Algorithm for Generic Search • Predict entry ‘e’ in the search data structure at which symbol symb is stored • Let symbe be the symbol found at eth entry . Compare symbe with symb. • If a match between the two is found, exit with success. • Else go to the next step. • Repeat steps 1 and 2 till all entries are evaluated or concluded that the symbol does not exist in the search data structure

  20. Search organization • Table Organization • Sequential Search Organization

  21. Search organization • Table Organization • Sequential Search Organization • Occupied entries • Free Entries • Physical Deletion • Logical Active/ Deleted Records

  22. Search organization • Binary Search Organization • Search based on relational operators • Entry number must not change after adding record • Hash Table Organization • Hash function is used for the mapping of a key value and the slot where that value belongs to the hash table • Hash function takes any key value from the collection and computes on the integer value from it in the range of slot names, between 0 and m-1.

More Related