2. What kind of work is done in Compiler LAB
Sessional?
Lexical analysis
Syntax analysis
Syntax-directed translation
Semantic analysis
type-checking
Run-time environments
Intermediate code generation
Code generation
Code optimization.
3. THE STRUCTURE OF A COMPILER
Converts source program semantically into equivalent target
program.
4. Function of a compiler
Record the variable names used in the source program.
Collect information about various attributes.
Provide information on storage allocation for
Name
Type
Scope
Procedure names
Argument types
Argument passing method
Type return type
6. What is symbol table?
Data structures used by compilers for holding
information about source-program.
a int LB1 UB1 SYMBOL TABLE pointer steers the symbol table to
remotely stored information for array
7. Symbol tables typically need to support multiple
declarations of the same identifier within a program
8. Use of Symbol Table
Generating intermediate or target code.
For verifying used identifiers have been
defined.
For verifying expressions & assignments are
semantically correct – type checking.
Information is used by the analysis and
synthesis phases.
9. Hashing
A symbol table can be implemented
in one of the following ways:
Linear (sorted or unsorted) list
Binary Search Tree
Hash table
10. Why use Hashing in Symbol Table?
Common data structure.
Must be organized for quicker search.
keyword or identifier is 'hashed' to produce an array
subscript.