Description
Lexical Analyzer
I converts the input program into a sequence of Tokens.
I can be implemented with the help of Finite Automata.
Lexical Analyzer
Programmer‘s View
Loop and switch Approach
/* Single caharacter lexemes */
#define LPAREN_TOK ’(’
#define GT_TOK ’>’
#define RPAREN_TOK ’)’
#define EQ_TOK ’=’
#define MINUS_TOK ’-’
#define SEMICOLON_TOK ’;’ /*………………..
…………………..*/
/* Reserved words */
#define WHILE_TOK 256
/*………………..
…………………..*/
/* Identifier, constants..*/
#define ID_TOK 350
#define INTCONST 351
/*………………..
…………………..*/




Reviews
There are no reviews yet.