<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
lexical	O
analysis	O
,	O
lexing	O
or	O
tokenization	O
is	O
the	O
process	O
of	O
converting	O
a	O
sequence	O
of	O
characters	O
(	O
such	O
as	O
in	O
a	O
computer	B-Application
program	I-Application
or	O
web	O
page	O
)	O
into	O
a	O
sequence	O
of	O
lexical	B-Application
tokens	I-Application
(	O
strings	O
with	O
an	O
assigned	O
and	O
thus	O
identified	O
meaning	O
)	O
.	O
</s>
<s>
A	O
lexer	O
is	O
generally	O
combined	O
with	O
a	O
parser	B-Language
,	O
which	O
together	O
analyze	O
the	O
syntax	O
of	O
programming	O
languages	O
,	O
web	O
pages	O
,	O
and	O
so	O
forth	O
.	O
</s>
<s>
A	O
lexer	O
forms	O
the	O
first	O
phase	O
of	O
a	O
compiler	B-Language
frontend	O
in	O
processing	O
.	O
</s>
<s>
In	O
older	O
languages	O
such	O
as	O
ALGOL	B-Language
,	O
the	O
initial	O
stage	O
was	O
instead	O
line	O
reconstruction	O
,	O
which	O
performed	O
unstropping	B-Application
and	O
removed	O
whitespace	O
and	O
comments	O
(	O
and	O
had	O
scannerless	O
parsers	B-Language
,	O
with	O
no	O
separate	O
lexer	O
)	O
.	O
</s>
<s>
Lexers	O
and	O
parsers	B-Language
are	O
most	O
often	O
used	O
for	O
compilers	B-Language
,	O
but	O
can	O
be	O
used	O
for	O
other	O
computer	O
language	O
tools	O
,	O
such	O
as	O
prettyprinters	B-Application
or	O
linters	B-Device
.	O
</s>
<s>
Lexers	O
are	O
generally	O
quite	O
simple	O
,	O
with	O
most	O
of	O
the	O
complexity	O
deferred	O
to	O
the	O
parser	B-Language
or	O
semantic	O
analysis	O
phases	O
,	O
and	O
can	O
often	O
be	O
generated	O
by	O
a	O
lexer	O
generator	O
,	O
notably	O
lex	B-General_Concept
or	O
derivatives	O
.	O
</s>
<s>
However	O
,	O
lexers	O
can	O
sometimes	O
include	O
some	O
complexity	O
,	O
such	O
as	O
phrase	O
structure	O
processing	O
to	O
make	O
input	O
easier	O
and	O
simplify	O
the	O
parser	B-Language
,	O
and	O
may	O
be	O
written	O
partly	O
or	O
fully	O
by	O
hand	O
,	O
either	O
to	O
support	O
more	O
features	O
or	O
for	O
performance	O
.	O
</s>
<s>
Lexical	O
analysis	O
is	O
also	O
an	O
important	O
early	O
stage	O
in	O
natural	B-Language
language	I-Language
processing	I-Language
,	O
where	O
text	O
or	O
sound	O
waves	O
are	O
segmented	O
into	O
words	O
and	O
other	O
units	O
.	O
</s>
<s>
The	O
word	O
lexeme	O
in	O
computer	B-General_Concept
science	I-General_Concept
is	O
defined	O
differently	O
than	O
lexeme	O
in	O
linguistics	O
.	O
</s>
<s>
A	O
lexeme	O
in	O
computer	B-General_Concept
science	I-General_Concept
roughly	O
corresponds	O
to	O
a	O
word	O
in	O
linguistics	O
(	O
not	O
to	O
be	O
confused	O
with	O
a	O
word	O
in	O
computer	O
architecture	O
)	O
,	O
although	O
in	O
some	O
cases	O
it	O
may	O
be	O
more	O
similar	O
to	O
a	O
morpheme	O
.	O
</s>
<s>
In	O
some	O
natural	O
languages	O
(	O
for	O
example	O
,	O
in	O
English	O
)	O
,	O
the	O
linguistic	O
lexeme	O
is	O
similar	O
to	O
the	O
lexeme	O
in	O
computer	B-General_Concept
science	I-General_Concept
,	O
but	O
this	O
is	O
generally	O
not	O
true	O
(	O
for	O
example	O
,	O
in	O
Chinese	O
,	O
it	O
is	O
highly	O
non-trivial	O
to	O
find	O
word	O
boundaries	O
due	O
to	O
the	O
lack	O
of	O
word	O
separators	O
)	O
.	O
</s>
<s>
A	O
lexical	B-Application
token	I-Application
or	O
simply	O
token	O
is	O
a	O
string	O
with	O
an	O
assigned	O
and	O
thus	O
identified	O
meaning	O
.	O
</s>
<s>
separator	B-Algorithm
(	O
also	O
known	O
as	O
punctuators	O
)	O
:	O
punctuation	O
characters	O
and	O
paired-delimiters	O
;	O
</s>
<s>
comment	O
:	O
line	O
,	O
block	O
(	O
Depends	O
on	O
the	O
compiler	B-Language
if	O
compiler	B-Language
implements	O
comments	O
as	O
tokens	O
otherwise	O
it	O
will	O
be	O
stripped	O
)	O
.	O
</s>
<s>
+	O
Examples	O
of	O
token	O
values	O
Token	O
name	O
Sample	O
token	O
values	O
identifier	O
,	O
,	O
keyword	O
,	O
,	O
separator	B-Algorithm
}	O
,	O
(	O
,	O
;	O
operator	O
,	O
,	O
literal	O
,	O
,	O
comment	O
,	O
</s>
<s>
Consider	O
this	O
expression	O
in	O
the	O
C	B-Language
programming	I-Language
language	I-Language
:	O
</s>
<s>
The	O
specification	O
of	O
a	O
programming	O
language	O
often	O
includes	O
a	O
set	O
of	O
rules	O
,	O
the	O
lexical	B-Application
grammar	I-Application
,	O
which	O
defines	O
the	O
lexical	O
syntax	O
.	O
</s>
<s>
The	O
lexical	O
syntax	O
is	O
usually	O
a	O
regular	B-General_Concept
language	I-General_Concept
,	O
with	O
the	O
grammar	O
rules	O
consisting	O
of	O
regular	B-Language
expressions	I-Language
;	O
they	O
define	O
the	O
set	O
of	O
possible	O
character	O
sequences	O
(	O
lexemes	O
)	O
of	O
a	O
token	O
.	O
</s>
<s>
First	O
,	O
in	O
off-side	B-Language
rule	I-Language
languages	O
that	O
delimit	B-Algorithm
blocks	O
with	O
indenting	O
,	O
initial	O
whitespace	O
is	O
significant	O
,	O
as	O
it	O
determines	O
block	O
structure	O
,	O
and	O
is	O
generally	O
handled	O
at	O
the	O
lexer	O
level	O
;	O
see	O
phrase	O
structure	O
,	O
below	O
.	O
</s>
<s>
Secondly	O
,	O
in	O
some	O
uses	O
of	O
lexers	O
,	O
comments	O
and	O
whitespace	O
must	O
be	O
preserved	O
–	O
for	O
examples	O
,	O
a	O
prettyprinter	B-Application
also	O
needs	O
to	O
output	O
the	O
comments	O
and	O
some	O
debugging	O
tools	O
may	O
provide	O
messages	O
to	O
the	O
programmer	O
showing	O
the	O
original	O
source	O
code	O
.	O
</s>
<s>
In	O
the	O
1960s	O
,	O
notably	O
for	O
ALGOL	B-Language
,	O
whitespace	O
and	O
comments	O
were	O
eliminated	O
as	O
part	O
of	O
the	O
line	O
reconstruction	O
phase	O
(	O
the	O
initial	O
phase	O
of	O
the	O
compiler	B-Language
frontend	O
)	O
,	O
but	O
this	O
separate	O
phase	O
has	O
been	O
eliminated	O
and	O
these	O
are	O
now	O
handled	O
by	O
the	O
lexer	O
.	O
</s>
<s>
The	O
process	O
can	O
be	O
considered	O
a	O
sub-task	O
of	O
parsing	B-Language
input	O
.	O
</s>
<s>
The	O
raw	O
input	O
,	O
the	O
43	O
characters	O
,	O
must	O
be	O
explicitly	O
split	O
into	O
the	O
9	O
tokens	O
with	O
a	O
given	O
space	O
delimiter	B-Algorithm
(	O
i.e.	O
,	O
matching	O
the	O
string	O
"	O
"	O
or	O
regular	B-Language
expression	I-Language
/\s{1}/	O
)	O
.	O
</s>
<s>
The	O
parser	B-Language
typically	O
retrieves	O
this	O
information	O
from	O
the	O
lexer	O
and	O
stores	O
it	O
in	O
the	O
abstract	B-Data_Structure
syntax	I-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
Some	O
methods	O
used	O
to	O
identify	O
tokens	O
include	O
:	O
regular	B-Language
expressions	I-Language
,	O
specific	O
sequences	O
of	O
characters	O
termed	O
a	O
flag	O
,	O
specific	O
separating	O
characters	O
called	O
delimiters	B-Algorithm
,	O
and	O
explicit	O
definition	O
by	O
a	O
dictionary	O
.	O
</s>
<s>
Categories	O
are	O
used	O
for	O
post-processing	O
of	O
the	O
tokens	O
either	O
by	O
the	O
parser	B-Language
or	O
by	O
other	O
functions	O
in	O
the	O
program	O
.	O
</s>
<s>
A	O
lexical	O
analyzer	O
generally	O
does	O
nothing	O
with	O
combinations	O
of	O
tokens	O
,	O
a	O
task	O
left	O
for	O
a	O
parser	B-Language
.	O
</s>
<s>
When	O
a	O
lexer	O
feeds	O
tokens	O
to	O
the	O
parser	B-Language
,	O
the	O
representation	O
used	O
is	O
typically	O
an	O
enumerated	O
list	O
of	O
number	O
representations	O
.	O
</s>
<s>
Tokens	O
are	O
defined	O
often	O
by	O
regular	B-Language
expressions	I-Language
,	O
which	O
are	O
understood	O
by	O
a	O
lexical	O
analyzer	O
generator	O
such	O
as	O
lex	B-General_Concept
.	O
</s>
<s>
The	O
lexical	O
analyzer	O
(	O
generated	O
automatically	O
by	O
a	O
tool	O
like	O
lex	B-General_Concept
,	O
or	O
hand-crafted	O
)	O
reads	O
in	O
a	O
stream	O
of	O
characters	O
,	O
identifies	O
the	O
lexemes	O
in	O
the	O
stream	O
,	O
and	O
categorizes	O
them	O
into	O
tokens	O
.	O
</s>
<s>
Following	O
tokenizing	O
is	O
parsing	B-Language
.	O
</s>
<s>
From	O
there	O
,	O
the	O
interpreted	O
data	O
may	O
be	O
loaded	O
into	O
data	O
structures	O
for	O
general	O
use	O
,	O
interpretation	O
,	O
or	O
compiling	B-Language
.	O
</s>
<s>
The	O
first	O
stage	O
,	O
the	O
scanner	O
,	O
is	O
usually	O
based	O
on	O
a	O
finite-state	B-Architecture
machine	I-Architecture
(	O
FSM	O
)	O
.	O
</s>
<s>
In	O
many	O
cases	O
,	O
the	O
first	O
non-whitespace	O
character	O
can	O
be	O
used	O
to	O
deduce	O
the	O
kind	O
of	O
token	O
that	O
follows	O
and	O
subsequent	O
input	O
characters	O
are	O
then	O
processed	O
one	O
at	O
a	O
time	O
until	O
reaching	O
a	O
character	O
that	O
is	O
not	O
in	O
the	O
set	O
of	O
characters	O
acceptable	O
for	O
that	O
token	O
(	O
this	O
is	O
termed	O
the	O
maximal	B-Application
munch	I-Application
,	O
or	O
longest	O
match	O
,	O
rule	O
)	O
.	O
</s>
<s>
In	O
some	O
languages	O
,	O
the	O
lexeme	O
creation	O
rules	O
are	O
more	O
complex	O
and	O
may	O
involve	O
backtracking	B-Algorithm
over	O
previously	O
read	O
characters	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C	B-Language
,	O
one	O
'	O
L	O
 '	O
character	O
is	O
not	O
enough	O
to	O
distinguish	O
between	O
an	O
identifier	O
that	O
begins	O
with	O
'	O
L	O
 '	O
and	O
a	O
wide-character	O
string	O
literal	O
.	O
</s>
<s>
The	O
lexeme	O
's	O
type	O
combined	O
with	O
its	O
value	O
is	O
what	O
properly	O
constitutes	O
a	O
token	O
,	O
which	O
can	O
be	O
given	O
to	O
a	O
parser	B-Language
.	O
</s>
<s>
Similarly	O
,	O
sometimes	O
evaluators	O
can	O
suppress	O
a	O
lexeme	O
entirely	O
,	O
concealing	O
it	O
from	O
the	O
parser	B-Language
,	O
which	O
is	O
useful	O
for	O
whitespace	O
and	O
comments	O
.	O
</s>
<s>
The	O
evaluators	O
for	O
identifiers	O
are	O
usually	O
simple	O
(	O
literally	O
representing	O
the	O
identifier	O
)	O
,	O
but	O
may	O
include	O
some	O
unstropping	B-Application
.	O
</s>
<s>
might	O
be	O
converted	O
into	O
the	O
following	O
lexical	B-Application
token	I-Application
stream	O
;	O
whitespace	O
is	O
suppressed	O
and	O
special	O
characters	O
have	O
no	O
value	O
:	O
</s>
<s>
Due	O
to	O
licensing	O
restrictions	O
of	O
existing	O
parsers	B-Language
,	O
it	O
may	O
be	O
necessary	O
to	O
write	O
a	O
lexer	O
by	O
hand	O
.	O
</s>
<s>
These	O
tools	O
generally	O
accept	O
regular	B-Language
expressions	I-Language
that	O
describe	O
the	O
tokens	O
allowed	O
in	O
the	O
input	O
stream	O
.	O
</s>
<s>
Each	O
regular	B-Language
expression	I-Language
is	O
associated	O
with	O
a	O
production	O
rule	O
in	O
the	O
lexical	B-Application
grammar	I-Application
of	O
the	O
programming	O
language	O
that	O
evaluates	O
the	O
lexemes	O
matching	O
the	O
regular	B-Language
expression	I-Language
.	O
</s>
<s>
These	O
tools	O
may	O
generate	O
source	O
code	O
that	O
can	O
be	O
compiled	B-Language
and	O
executed	O
or	O
construct	O
a	O
state	B-Application
transition	I-Application
table	I-Application
for	O
a	O
finite-state	B-Architecture
machine	I-Architecture
(	O
which	O
is	O
plugged	O
into	O
template	O
code	O
for	O
compiling	B-Language
and	O
executing	O
)	O
.	O
</s>
<s>
Regular	B-Language
expressions	I-Language
compactly	O
represent	O
patterns	O
that	O
the	O
characters	O
in	O
lexemes	O
might	O
follow	O
.	O
</s>
<s>
Regular	B-Language
expressions	I-Language
and	O
the	O
finite-state	B-Architecture
machines	I-Architecture
they	O
generate	O
are	O
not	O
powerful	O
enough	O
to	O
handle	O
recursive	O
patterns	O
,	O
such	O
as	O
"	O
n	O
opening	O
parentheses	O
,	O
followed	O
by	O
a	O
statement	O
,	O
followed	O
by	O
n	O
closing	O
parentheses.	O
"	O
</s>
<s>
They	O
are	O
unable	O
to	O
keep	O
count	O
,	O
and	O
verify	O
that	O
n	O
is	O
the	O
same	O
on	O
both	O
sides	O
,	O
unless	O
a	O
finite	O
set	O
of	O
permissible	O
values	O
exists	O
for	O
n	O
.	O
It	O
takes	O
a	O
full	O
parser	B-Language
to	O
recognize	O
such	O
patterns	O
in	O
their	O
full	O
generality	O
.	O
</s>
<s>
A	O
parser	B-Language
can	O
push	O
parentheses	O
on	O
a	O
stack	O
and	O
then	O
try	O
to	O
pop	O
them	O
off	O
and	O
see	O
if	O
the	O
stack	O
is	O
empty	O
at	O
the	O
end	O
(	O
see	O
example	O
in	O
the	B-Language
Structure	I-Language
and	I-Language
Interpretation	I-Language
of	I-Language
Computer	I-Language
Programs	I-Language
book	O
)	O
.	O
</s>
<s>
However	O
,	O
even	O
here	O
there	O
are	O
many	O
edge	O
cases	O
such	O
as	O
contractions	O
,	O
hyphenated	O
words	O
,	O
emoticons	B-Protocol
,	O
and	O
larger	O
constructs	O
such	O
as	O
URIs	B-Protocol
(	O
which	O
for	O
some	O
purposes	O
may	O
count	O
as	O
single	O
tokens	O
)	O
.	O
</s>
<s>
Some	O
ways	O
to	O
address	O
the	O
more	O
difficult	O
problems	O
include	O
developing	O
more	O
complex	O
heuristics	O
,	O
querying	O
a	O
table	O
of	O
common	O
special-cases	O
,	O
or	O
fitting	O
the	O
tokens	O
to	O
a	O
language	B-Language
model	I-Language
that	O
identifies	O
collocations	O
in	O
a	O
later	O
processing	O
step	O
.	O
</s>
<s>
Lexers	O
are	O
often	O
generated	O
by	O
a	O
lexer	O
generator	O
,	O
analogous	O
to	O
parser	B-Language
generators	I-Language
,	O
and	O
such	O
tools	O
often	O
come	O
together	O
.	O
</s>
<s>
The	O
most	O
established	O
is	O
lex	B-General_Concept
,	O
paired	O
with	O
the	O
yacc	B-Application
parser	B-Language
generator	I-Language
,	O
or	O
rather	O
some	O
of	O
their	O
many	O
reimplementations	O
,	O
like	O
flex	B-General_Concept
(	O
often	O
paired	O
with	O
GNU	B-Application
Bison	I-Application
)	O
.	O
</s>
<s>
These	O
generators	O
are	O
a	O
form	O
of	O
domain-specific	B-Language
language	I-Language
,	O
taking	O
in	O
a	O
lexical	B-Application
specification	I-Application
–	O
generally	O
regular	B-Language
expressions	I-Language
with	O
some	O
markup	O
–	O
and	O
emitting	O
a	O
lexer	O
.	O
</s>
<s>
Lexer	O
performance	O
is	O
a	O
concern	O
,	O
and	O
optimizing	O
is	O
worthwhile	O
,	O
more	O
so	O
in	O
stable	O
languages	O
where	O
the	O
lexer	O
is	O
run	O
very	O
often	O
(	O
such	O
as	O
C	B-Language
or	O
HTML	O
)	O
.	O
</s>
<s>
lex/flex	O
-generated	O
lexers	O
are	O
reasonably	O
fast	O
,	O
but	O
improvements	O
of	O
two	O
to	O
three	O
times	O
are	O
possible	O
using	O
more	O
tuned	O
generators	O
.	O
</s>
<s>
The	O
lex/flex	O
family	O
of	O
generators	O
uses	O
a	O
table-driven	O
approach	O
which	O
is	O
much	O
less	O
efficient	O
than	O
the	O
directly	O
coded	O
approach	O
.	O
</s>
<s>
Tools	O
like	O
re2c	B-Application
have	O
proven	O
to	O
produce	O
engines	O
that	O
are	O
between	O
two	O
and	O
three	O
times	O
faster	O
than	O
flex	B-General_Concept
produced	O
engines	O
.	O
</s>
<s>
Omitting	O
tokens	O
,	O
notably	O
whitespace	O
and	O
comments	O
,	O
is	O
very	O
common	O
,	O
when	O
these	O
are	O
not	O
needed	O
by	O
the	O
compiler	B-Language
.	O
</s>
<s>
This	O
is	O
done	O
mainly	O
to	O
group	O
tokens	O
into	O
statements	O
,	O
or	O
statements	O
into	O
blocks	O
,	O
to	O
simplify	O
the	O
parser	B-Language
.	O
</s>
<s>
Examples	O
include	O
bash	B-Operating_System
,	O
other	O
shell	O
scripts	O
and	O
Python	B-Language
.	O
</s>
<s>
Optional	O
semicolons	O
or	O
other	O
terminators	O
or	O
separators	O
are	O
also	O
sometimes	O
handled	O
at	O
the	O
parser	B-Language
level	O
,	O
notably	O
in	O
the	O
case	O
of	O
trailing	O
commas	O
or	O
semicolons	O
.	O
</s>
<s>
Semicolon	O
insertion	O
is	O
a	O
feature	O
of	O
BCPL	B-Language
and	O
its	O
distant	O
descendant	O
Go	B-Application
,	O
though	O
it	O
is	O
absent	O
in	O
B	O
or	O
C	B-Language
.	O
Semicolon	O
insertion	O
is	O
present	O
in	O
JavaScript	B-Language
,	O
though	O
the	O
rules	O
are	O
somewhat	O
complex	O
and	O
much-criticized	O
;	O
to	O
avoid	O
bugs	O
,	O
some	O
recommend	O
always	O
using	O
semicolons	O
,	O
while	O
others	O
use	O
initial	O
semicolons	O
,	O
termed	O
defensive	O
semicolons	O
,	O
at	O
the	O
start	O
of	O
potentially	O
ambiguous	O
statements	O
.	O
</s>
<s>
The	O
off-side	B-Language
rule	I-Language
(	O
blocks	O
determined	O
by	O
indenting	O
)	O
can	O
be	O
implemented	O
in	O
the	O
lexer	O
,	O
as	O
in	O
Python	B-Language
,	O
where	O
increasing	O
the	O
indenting	O
results	O
in	O
the	O
lexer	O
emitting	O
an	O
INDENT	O
token	O
,	O
and	O
decreasing	O
the	O
indenting	O
results	O
in	O
the	O
lexer	O
emitting	O
a	O
DEDENT	O
token	O
.	O
</s>
<s>
This	O
requires	O
that	O
the	O
lexer	O
hold	O
state	O
,	O
namely	O
the	O
current	O
indent	O
level	O
,	O
and	O
thus	O
can	O
detect	O
changes	O
in	O
indenting	O
when	O
this	O
changes	O
,	O
and	O
thus	O
the	O
lexical	B-Application
grammar	I-Application
is	O
not	O
context-free	O
:	O
INDENT	O
–	O
DEDENT	O
depend	O
on	O
the	O
contextual	O
information	O
of	O
prior	O
indent	O
level	O
.	O
</s>
<s>
Generally	O
lexical	B-Application
grammars	I-Application
are	O
context-free	O
,	O
or	O
almost	O
so	O
,	O
and	O
thus	O
require	O
no	O
looking	O
back	O
or	O
ahead	O
,	O
or	O
backtracking	B-Algorithm
,	O
which	O
allows	O
a	O
simple	O
,	O
clean	O
,	O
and	O
efficient	O
implementation	O
.	O
</s>
<s>
This	O
also	O
allows	O
simple	O
one-way	O
communication	O
from	O
lexer	O
to	O
parser	B-Language
,	O
without	O
needing	O
any	O
information	O
flowing	O
back	O
to	O
the	O
lexer	O
.	O
</s>
<s>
Simple	O
examples	O
include	O
:	O
semicolon	O
insertion	O
in	O
Go	B-Application
,	O
which	O
requires	O
looking	O
back	O
one	O
token	O
;	O
concatenation	O
of	O
consecutive	O
string	O
literals	O
in	O
Python	B-Language
,	O
which	O
requires	O
holding	O
one	O
token	O
in	O
a	O
buffer	O
before	O
emitting	O
it	O
(	O
to	O
see	O
if	O
the	O
next	O
token	O
is	O
another	O
string	O
literal	O
)	O
;	O
and	O
the	O
off-side	B-Language
rule	I-Language
in	O
Python	B-Language
,	O
which	O
requires	O
maintaining	O
a	O
count	O
of	O
indent	O
level	O
(	O
indeed	O
,	O
a	O
stack	O
of	O
each	O
indent	O
level	O
)	O
.	O
</s>
<s>
These	O
examples	O
all	O
only	O
require	O
lexical	O
context	O
,	O
and	O
while	O
they	O
complicate	O
a	O
lexer	O
somewhat	O
,	O
they	O
are	O
invisible	O
to	O
the	O
parser	B-Language
and	O
later	O
phases	O
.	O
</s>
<s>
A	O
more	O
complex	O
example	O
is	O
the	B-Language
lexer	I-Language
hack	I-Language
in	O
C	B-Language
,	O
where	O
the	O
token	O
class	O
of	O
a	O
sequence	O
of	O
characters	O
cannot	O
be	O
determined	O
until	O
the	O
semantic	O
analysis	O
phase	O
,	O
since	O
typedef	B-Language
names	O
and	O
variable	O
names	O
are	O
lexically	O
identical	O
but	O
constitute	O
different	O
token	O
classes	O
.	O
</s>
<s>
Thus	O
in	O
the	O
hack	O
,	O
the	O
lexer	O
calls	O
the	O
semantic	O
analyzer	O
(	O
say	O
,	O
symbol	O
table	O
)	O
and	O
checks	O
if	O
the	O
sequence	O
requires	O
a	O
typedef	B-Language
name	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
information	O
must	O
flow	O
back	O
not	O
from	O
the	O
parser	B-Language
only	O
,	O
but	O
from	O
the	O
semantic	O
analyzer	O
back	O
to	O
the	O
lexer	O
,	O
which	O
complicates	O
design	O
.	O
</s>
