Lecture 2.1 - Lexical Analysis
Lecture 2.1 - Lexical Analysis
Theory of Computation
and
Compiler Design
Lecture-2.1
Lexical Analyser
X identifier
= Assignment operator
Y identifier
+ Addition operator
10 Number
} ) Operator
{ Operator
}
If Keyword
14-12-2020 18 Dr. Chandan Kumar Behera
Example of Lexical Analysis, Tokens, Non-Tokens
#include <stdio.h>
Non-tokens
int maximum(int x, int y)
{ Type Examples
Comment // This will compare 2 numbers
// This will compare 2 numbers
Pre-processor directive #include <stdio.h>
if (x > y)
Pre-processor directive #define NUMS 8,9
return x; Macro NUMS
else Whitespace /n /b /t
{
return y;
}
}