Symbol table-A data structure
1.Symbol table--it stores all identifiers(s variable names, function names) and their attributes along with it.
2.start from lexical phases and used till phase code optimization.
3. symbol table created during lexical analysis phaseaccessible by all phases manipulated by all phases if needed,or saying Symbol table is used by both the analysis and the synthesis parts of a compiler.
or saying it is used by both front end and backend part of the compiler phases
4.also created by two pass assembler in their first pass
5.Implementation-can be implementation by using array, hash table, tree and linked lists.
-->If a compiler is to handle a small amount of data, then the symbol table can be implemented as an unordered list, which is easy to code, but it is only suitable for small tables only. A symbol table can be implemented in one of the following ways:
1.Linear (sorted or unsorted) list
2.Binary Search Tree
3.Hash table
Among all, symbol tables are mostly implemented as hash tables, where the source code symbol itself is treated as a key for the hash function and the return value is the information about the symbol.
6.Symbol table implement by hash table mostly and in hash table occupational density is number of entries/length.
7.
A Symbol Table in programming is used for:
*Checking Type Compatibility*: The symbol table stores the data type of identifiers, which is used during semantic analysis to check if the expressions and assignments are semantically correct.
Suppressing Duplication of Error Messages: Symbol tables can help in managing errors. For instance, if a variable is declared twice, the symbol table can help detect this error and suppress duplicate error messages.
Storage Allocation: The symbol table can store information about the memory locations of identifiers, which can be used for storage allocation