We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10
Lexical Analyzer (Lexer, Scanner, Tokenize)
It is a First phase of Compiler. It takes source program as a input. Read
source program character by character. It convert source program into a stream of a valid words of the language know as Token. It Takes source program as a input. Read Source program character by character. Generate stream of valid words called Token. Characteristics: Read line by line (character by character). Remove comments. Remove Spaces Tabs. List Down the errors. 1. Token Terminal symbols of source language. Valid kind of words. It may be, Identifiers. operators. Numbers. Keywords. Constants. Punctuations. Reserved Words / special Characters. Int a = 5; 2. Patterns Patterns are rules that define all the Tokens. Identify Language: Using Regular expressions. Language for Identifier: (- + L) (L + D + --) Regular Language give us the patterns. 3. Lexeme Specific instance of a tokens generated using a particular pattern. Count = Count + Temp ;
I’d Op I’d Op I’d Pun
Instances according to patterns I’d Op Pun
(Count, Temp) (=, +) (;)
Work Give Error Messages. List Downs the errors. Check Missing Character’s. Exceeding Length. Unmatched String. Eliminate Comments. White Space. Example Print F (“ I = % d, & I = % x ” , I, & i); Quiz int main() { \* find max of a and b*/