LEXICAL ANALYZER

Lexical Analyzer:

 

The Lexical Analyzer begins the analysis of  the source program by reading the input,  character by character,  grouping characters into individual words and symbols.These Words and Symbols are called as Tokens. Blanks are eliminated during Lexical Analysis.Lexical Analyzer is also called as Scanner, because it scans the source Program and converts it into Tokens.

 

Example : Lexical Analysis

 

Lexical Example

 

SYMBOL TABLE:

 

•A compiler has to record the identifier and their attributes

 

•It is a data structure containing a record for each identifier

 

•When the lexical analyzer detects an id in the source program, the id is stored in the symbol table

 

Symbol Table

 

 

 

 

Structure of a Compiler by M.Sharmila and R.Jayabharathi- Dept of IT