Cse 309 Slides 03 Lexicalanalysis
Cse 309 Slides 03 Lexicalanalysis
Lexical Analysis
Professor
Department of Computer Science and Engineering
Bangladesh University of Engineering and Technology
Dhaka-1000, Bangladesh
August, 2008
lexerror1.cpp
#include <iostream>
int main()
{
‘int i, j, k;
return 0;
}
lexerror2.cpp
int main()
{
int 5test;
return 0;
}
We can combine the buffer-end test with the test for the
current character if we extend each buffer to hold a
sentinel character at the end.
The sentinel is a special character that cannot be part of
the source program, and a natural choice is the character
eof.