Relationship Among Token, Lexeme & Pattern

3,881 views 8 slides Feb 28, 2022
Slide 1
Slide 1 of 8
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8

About This Presentation

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...


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