









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










(^) The lexical analyzer breaks a sentence into a sequence of words or tokens and ignores white spaces and comments. (^) It generates a stream of tokens from the input. (^) This is modeled through regular expressions and the structure is recognized through finite state automata. (^) If the token is not valid i.e., does not fall into any of the identifiable groups, then the lexical analyzer reports an error. (^) Lexical analysis thus involves recognizing the
tokens in the source program and reporting errors, if any.
(^) Token
(^) Since a token can represent more than one lexeme, additional information should be held for that specific lexeme. This additional information is called as the attribute of the token. (^) For simplicity, a token may have a single attribute which holds the required information for that token.
(^) (e.g) fi(a==f(x))….
(^) Token: A sequence of characters to be
treated as a single unit. (^) Examples of tokens.
**- Reserved words (e.g. begin, end, struct, if etc.)