Organization for Block Structured Languages

Estudies4you
Organization for Block Structured Languages:
  • The block structured language is a kind of language in which sections of source code is within some matching pair of delimiters such as “{“ and “}” or begin and end
  • Such a section gets executed as one unit or one procedure or a function or it may be controlled by some conditional statements (if, while, do-while)
  • Normally, block structured languages support structured programming approach
                Example: C, C++, JAVA, PASCAL, FORTRAM, LISP and SNOBOL
  • Non-block structured languages are LISP, FORTRAN and SNOBOL
Implementation of Symbol Table:
  • Each entry in the symbol table can be implemented as a record with several fields
  • The following data structures are used for organization of block structured languages:
                Linear List
                Self-Organizing List
                Hashing
                Tree Structure

Symbol table organization using Linear List:
  • A linear list of records is the easiest way to implement the symbol table
  • In this method, an array is used to store names and associated information
  • The new names are added to the symbol table in the order they arrive
  • The pointer “available” is maintained at the end of all stored records
  • To retrieve the information about some name we start from beginning of array and go on searching up to available pointer. If we reach at pointer available without finding a name we get an error “use of undeclared name”
  • While inserting a new name we should ensure that it is not already present. If it is already present then another error occurs, i.e., “Multiple Defined Name”.
Advantages:
  • It takes minimum amount of space
  • Additions are simple
  • Limitations
  • Higher access time
Linear List as follows:
Name 1
Information 1
Name 2
Information 2
.
.
.
.
.
.
.
.
Name n
Information n

Symbol Table organization using self-Organizing List:
  • In this method, symbol table is implemented using linked list. A link field is added to each record
  • We search the records in the order pointed by the link of link field
  • A pointer “First” is maintained to point to first record of the symbol table
Organization for Block Structured Languages, Implementation of Symbol Table, Symbol table organization using Linear List, linear list in symbol table, self organizing list in symbol table, hashing in symbol table, tree structure in symbol table, advantages of symbol table, advantages of block structured languages in symbol table, r16 jntuh compiler design lecture notes, jntuh r16 compiler design notes pdf, estudies4you, jntu compiler design notes unitwise


  • The reference to these names can be Name 3, Name 4, Name 2
  • When the name is reference or created, it is moved to the front of the list
  • The most frequently referred names will tend to be at the front of the list. Hence, access time to most frequently referred names wil be the least
Advantages
  • It takes minimum amount of space
  • Additions are simple
  • Limitation
  • Higher access time
To Top