Relationship among Token, Lexeme and Pattern
Outline
Token
Lexeme
Pattern
Relationship
Tokens : A token is sequence of characters that can be treated
as a unit/single logical entity.
Examples
Keywords
Examples : for, while, if etc.
Identifier
Examples : Variable...
Relationship among Token, Lexeme and Pattern
Outline
Token
Lexeme
Pattern
Relationship
Tokens : A token is sequence of characters that can be treated
as a unit/single logical entity.
Examples
Keywords
Examples : for, while, if etc.
Identifier
Examples : Variable name, function name, etc.
Operators
Examples : '+', '++', '-' etc.
Separators
Examples : ',' ';' etc.
Pattern
Pattern is a rule describing all those lexemes that can represent a particular token in a source language.
Lexeme
It is a sequence of characters in the source program that is matched by the pattern for a token.
Example : “float”, “=“, “223”, “;”
Size: 573.36 KB
Language: en
Added: Feb 28, 2022
Slides: 8 pages
Slide Content
Subject: Compiler Design Presentation On Relationship Among Tokens, Pattern & Lexemes Submitted To : Mr. Gaurav Dubey (Asst. Prof. , Department of Computer Science & Engineering) Submitted By : Bharat Rathore 0905CS191062 Activity - 1
OUTLINES Token Lexeme Pattern Relationship
Tokens Tokens : A token is sequence of characters that can be treated as a unit/single logical entity. Examples Keywords Examples : for, while, if etc. Identifier Examples : Variable name, function name, etc. Operators Examples : '+', '++', '-' etc. Separators Examples : ',' ';' etc.
Example on Tokens int a = 10 ; Keyword Constant Identifier Separator Operator
Lexeme It is a sequence of characters in the source program that is matched by the pattern for a token. Example : “float”, “=“, “223”, “;”
Pattern Pattern is a rule describing all those lexemes that can represent a particular token in a source language.
Relationship Relationship Between Token, Pattern & Lexeme