<s>
A	O
finite-state	B-Architecture
machine	I-Architecture
(	O
FSM	O
)	O
or	O
finite-state	B-Architecture
automaton	I-Architecture
(	O
FSA	O
,	O
plural	O
:	O
automata	O
)	O
,	O
finite	B-Architecture
automaton	I-Architecture
,	O
or	O
simply	O
a	O
state	B-Architecture
machine	I-Architecture
,	O
is	O
a	O
mathematical	O
model	O
of	O
computation	O
.	O
</s>
<s>
It	O
is	O
an	O
abstract	B-Application
machine	I-Application
that	O
can	O
be	O
in	O
exactly	O
one	O
of	O
a	O
finite	O
number	O
of	O
states	B-Application
at	O
any	O
given	O
time	O
.	O
</s>
<s>
The	O
FSM	O
can	O
change	O
from	O
one	O
state	O
to	O
another	O
in	O
response	O
to	O
some	O
inputs	B-General_Concept
;	O
the	O
change	O
from	O
one	O
state	O
to	O
another	O
is	O
called	O
a	O
transition	O
.	O
</s>
<s>
An	O
FSM	O
is	O
defined	O
by	O
a	O
list	O
of	O
its	O
states	B-Application
,	O
its	O
initial	O
state	O
,	O
and	O
the	O
inputs	B-General_Concept
that	O
trigger	O
each	O
transition	O
.	O
</s>
<s>
Finite-state	B-Architecture
machines	I-Architecture
are	O
of	O
two	O
types	O
—	O
deterministic	B-General_Concept
finite-state	I-General_Concept
machines	I-General_Concept
and	O
non-deterministic	B-General_Concept
finite-state	I-General_Concept
machines	I-General_Concept
.	O
</s>
<s>
A	O
deterministic	B-General_Concept
finite-state	I-General_Concept
machine	I-General_Concept
can	O
be	O
constructed	O
equivalent	O
to	O
any	O
non-deterministic	O
one	O
.	O
</s>
<s>
The	O
behavior	O
of	O
state	B-Architecture
machines	I-Architecture
can	O
be	O
observed	O
in	O
many	O
devices	O
in	O
modern	O
society	O
that	O
perform	O
a	O
predetermined	O
sequence	O
of	O
actions	O
depending	O
on	O
a	O
sequence	O
of	O
events	O
with	O
which	O
they	O
are	O
presented	O
.	O
</s>
<s>
The	O
finite-state	B-Architecture
machine	I-Architecture
has	O
less	O
computational	O
power	O
than	O
some	O
other	O
models	O
of	O
computation	O
such	O
as	O
the	B-Architecture
Turing	I-Architecture
machine	I-Architecture
.	O
</s>
<s>
The	O
computational	O
power	O
distinction	O
means	O
there	O
are	O
computational	O
tasks	O
that	O
a	O
Turing	B-Architecture
machine	I-Architecture
can	O
do	O
but	O
an	O
FSM	O
cannot	O
.	O
</s>
<s>
This	O
is	O
because	O
an	O
FSM	O
's	O
memory	B-General_Concept
is	O
limited	O
by	O
the	O
number	O
of	O
states	B-Application
it	O
has	O
.	O
</s>
<s>
A	O
finite-state	B-Architecture
machine	I-Architecture
has	O
the	O
same	O
computational	O
power	O
as	O
a	O
Turing	B-Architecture
machine	I-Architecture
that	O
is	O
restricted	O
such	O
that	O
its	O
head	O
may	O
only	O
perform	O
"	O
read	O
"	O
operations	O
,	O
and	O
always	O
has	O
to	O
move	O
from	O
left	O
to	O
right	O
.	O
</s>
<s>
FSMs	O
are	O
studied	O
in	O
the	O
more	O
general	O
field	O
of	O
automata	B-Application
theory	I-Application
.	O
</s>
<s>
An	O
example	O
of	O
a	O
simple	O
mechanism	O
that	O
can	O
be	O
modeled	O
by	O
a	O
state	B-Architecture
machine	I-Architecture
is	O
a	O
turnstile	O
.	O
</s>
<s>
Considered	O
as	O
a	O
state	B-Architecture
machine	I-Architecture
,	O
the	O
turnstile	O
has	O
two	O
possible	O
states	B-Application
:	O
Locked	O
and	O
Unlocked	O
.	O
</s>
<s>
There	O
are	O
two	O
possible	O
inputs	B-General_Concept
that	O
affect	O
its	O
state	O
:	O
putting	O
a	O
coin	O
in	O
the	O
slot	O
(	O
coin	O
)	O
and	O
pushing	O
the	O
arm	O
(	O
push	O
)	O
.	O
</s>
<s>
In	O
the	O
unlocked	O
state	O
,	O
putting	O
additional	O
coins	O
in	O
has	O
no	O
effect	O
;	O
that	O
is	O
,	O
giving	O
additional	O
coin	O
inputs	B-General_Concept
does	O
not	O
change	O
the	O
state	O
.	O
</s>
<s>
The	O
turnstile	O
state	B-Architecture
machine	I-Architecture
can	O
be	O
represented	O
by	O
a	O
state-transition	B-Application
table	I-Application
,	O
showing	O
for	O
each	O
possible	O
state	O
,	O
the	O
transitions	O
between	O
them	O
(	O
based	O
upon	O
the	O
inputs	B-General_Concept
given	O
to	O
the	O
machine	O
)	O
and	O
the	O
outputs	O
resulting	O
from	O
each	O
input	O
:	O
</s>
<s>
The	O
turnstile	O
state	B-Architecture
machine	I-Architecture
can	O
also	O
be	O
represented	O
by	O
a	O
directed	O
graph	O
called	O
a	O
state	B-Application
diagram	I-Application
(	O
above	O
)	O
.	O
</s>
<s>
In	O
some	O
finite-state	B-Architecture
machine	I-Architecture
representations	O
,	O
it	O
is	O
also	O
possible	O
to	O
associate	O
actions	O
with	O
a	O
state	O
:	O
</s>
<s>
Several	O
state-transition	B-Application
table	I-Application
types	O
are	O
used	O
.	O
</s>
<s>
An	O
FSM	O
definition	O
including	O
the	O
full	O
action	O
's	O
information	O
is	O
possible	O
using	O
state	B-Application
tables	I-Application
(	O
see	O
also	O
virtual	B-Application
finite-state	I-Application
machine	I-Application
)	O
.	O
</s>
<s>
+	O
State-transition	B-Application
table	I-Application
State	O
A	O
State	O
B	O
State	O
C	O
Input	O
X	O
...	O
...	O
...	O
</s>
<s>
The	O
Unified	B-Language
Modeling	I-Language
Language	I-Language
has	O
a	O
notation	O
for	O
describing	O
state	B-Architecture
machines	I-Architecture
.	O
</s>
<s>
UML	B-Application
state	I-Application
machines	I-Application
overcome	O
the	O
limitations	O
of	O
traditional	O
finite-state	B-Architecture
machines	I-Architecture
while	O
retaining	O
their	O
main	O
benefits	O
.	O
</s>
<s>
UML	B-Application
state	I-Application
machines	I-Application
introduce	O
the	O
new	O
concepts	O
of	O
hierarchically	O
nested	O
states	B-Application
and	O
orthogonal	O
regions	O
,	O
while	O
extending	O
the	O
notion	O
of	O
actions	O
.	O
</s>
<s>
UML	B-Application
state	I-Application
machines	I-Application
have	O
the	O
characteristics	O
of	O
both	O
Mealy	B-General_Concept
machines	I-General_Concept
and	O
Moore	B-General_Concept
machines	I-General_Concept
.	O
</s>
<s>
They	O
support	O
actions	O
that	O
depend	O
on	O
both	O
the	O
state	O
of	O
the	O
system	O
and	O
the	O
triggering	O
event	O
,	O
as	O
in	O
Mealy	B-General_Concept
machines	I-General_Concept
,	O
as	O
well	O
as	O
entry	O
and	O
exit	O
actions	O
,	O
which	O
are	O
associated	O
with	O
states	B-Application
rather	O
than	O
transitions	O
,	O
as	O
in	O
Moore	B-General_Concept
machines	I-General_Concept
.	O
</s>
<s>
The	O
Specification	B-Application
and	I-Application
Description	I-Application
Language	I-Application
is	O
a	O
standard	O
from	O
ITU	O
that	O
includes	O
graphical	O
symbols	O
to	O
describe	O
actions	O
in	O
the	O
transition	O
:	O
</s>
<s>
SDL	O
embeds	O
basic	O
data	O
types	O
called	O
"	O
Abstract	O
Data	O
Types	O
"	O
,	O
an	O
action	O
language	O
,	O
and	O
an	O
execution	O
semantic	O
in	O
order	O
to	O
make	O
the	O
finite-state	B-Architecture
machine	I-Architecture
executable	O
.	O
</s>
<s>
In	O
addition	O
to	O
their	O
use	O
in	O
modeling	O
reactive	O
systems	O
presented	O
here	O
,	O
finite-state	B-Architecture
machines	I-Architecture
are	O
significant	O
in	O
many	O
different	O
areas	O
,	O
including	O
electrical	O
engineering	O
,	O
linguistics	O
,	O
computer	B-General_Concept
science	I-General_Concept
,	O
philosophy	O
,	O
biology	O
,	O
mathematics	O
,	O
video	O
game	O
programming	O
,	O
and	O
logic	O
.	O
</s>
<s>
Finite-state	B-Architecture
machines	I-Architecture
are	O
a	O
class	O
of	O
automata	O
studied	O
in	O
automata	B-Application
theory	I-Application
and	O
the	O
theory	O
of	O
computation	O
.	O
</s>
<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
finite-state	B-Architecture
machines	I-Architecture
are	O
widely	O
used	O
in	O
modeling	O
of	O
application	O
behavior	O
(	O
control	O
theory	O
)	O
,	O
design	O
of	O
hardware	O
digital	O
systems	O
,	O
software	B-General_Concept
engineering	I-General_Concept
,	O
compilers	B-Language
,	O
network	O
protocols	O
,	O
and	O
computational	O
linguistics	O
.	O
</s>
<s>
Finite-state	B-Architecture
machines	I-Architecture
can	O
be	O
subdivided	O
into	O
acceptors	O
,	O
classifiers	O
,	O
transducers	O
and	O
sequencers	O
.	O
</s>
<s>
Once	O
all	O
input	O
has	O
been	O
received	O
,	O
if	O
the	O
current	O
state	O
is	O
an	O
accepting	B-Architecture
state	I-Architecture
,	O
the	O
input	O
is	O
accepted	O
;	O
otherwise	O
it	O
is	O
rejected	O
.	O
</s>
<s>
The	O
start	B-Architecture
state	I-Architecture
can	O
also	O
be	O
an	O
accepting	B-Architecture
state	I-Architecture
,	O
in	O
which	O
case	O
the	O
acceptor	O
accepts	O
the	O
empty	O
string	O
.	O
</s>
<s>
In	O
this	O
acceptor	O
,	O
the	O
only	O
accepting	B-Architecture
state	I-Architecture
is	O
state	O
7	O
.	O
</s>
<s>
A	O
(	O
possibly	O
infinite	O
)	O
set	O
of	O
symbol	O
sequences	O
,	O
called	O
a	O
formal	O
language	O
,	O
is	O
a	O
regular	B-General_Concept
language	I-General_Concept
if	O
there	O
is	O
some	O
acceptor	O
that	O
accepts	O
exactly	O
that	O
set	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
set	O
of	O
binary	O
strings	O
with	O
an	O
even	O
number	O
of	O
zeroes	O
is	O
a	O
regular	B-General_Concept
language	I-General_Concept
(	O
cf	O
.	O
</s>
<s>
By	O
definition	O
,	O
the	O
languages	O
accepted	O
by	O
acceptors	O
are	O
the	O
regular	B-General_Concept
languages	I-General_Concept
.	O
</s>
<s>
An	O
example	O
of	O
an	O
accepting	B-Architecture
state	I-Architecture
appears	O
in	O
Fig	O
.	O
</s>
<s>
5	O
:	O
a	O
deterministic	B-General_Concept
finite	I-General_Concept
automaton	I-General_Concept
(	O
DFA	B-General_Concept
)	O
that	O
detects	O
whether	O
the	O
binary	O
input	O
string	O
contains	O
an	O
even	O
number	O
of	O
0s	O
.	O
</s>
<s>
S1	O
(	O
which	O
is	O
also	O
the	O
start	B-Architecture
state	I-Architecture
)	O
indicates	O
the	O
state	O
at	O
which	O
an	O
even	O
number	O
of	O
0s	O
has	O
been	O
input	O
.	O
</s>
<s>
S1	O
is	O
therefore	O
an	O
accepting	B-Architecture
state	I-Architecture
.	O
</s>
<s>
This	O
acceptor	O
will	O
finish	O
in	O
an	O
accept	B-Architecture
state	I-Architecture
,	O
if	O
the	O
binary	O
string	O
contains	O
an	O
even	O
number	O
of	O
0s	O
(	O
including	O
any	O
binary	O
string	O
containing	O
no	O
0s	O
)	O
.	O
</s>
<s>
Moore	B-General_Concept
machine	I-General_Concept
The	O
FSM	O
uses	O
only	O
entry	O
actions	O
,	O
i.e.	O
,	O
output	O
depends	O
only	O
on	O
state	O
.	O
</s>
<s>
The	O
state	B-Architecture
machine	I-Architecture
recognizes	O
two	O
commands	O
:	O
"	O
command_open	O
"	O
and	O
"	O
command_close	O
"	O
,	O
which	O
trigger	O
state	O
changes	O
.	O
</s>
<s>
States	B-Application
"	O
Opened	O
"	O
and	O
"	O
Closed	O
"	O
stop	O
the	O
motor	O
when	O
fully	O
opened	O
or	O
closed	O
.	O
</s>
<s>
They	O
signal	O
to	O
the	O
outside	O
world	O
(	O
e.g.	O
,	O
to	O
other	O
state	B-Architecture
machines	I-Architecture
)	O
the	O
situation	O
:	O
"	O
door	O
is	O
open	O
"	O
or	O
"	O
door	O
is	O
closed	O
"	O
.	O
</s>
<s>
Mealy	B-General_Concept
machine	I-General_Concept
The	O
FSM	O
also	O
uses	O
input	O
actions	O
,	O
i.e.	O
,	O
output	O
depends	O
on	O
input	O
and	O
state	O
.	O
</s>
<s>
The	O
use	O
of	O
a	O
Mealy	B-General_Concept
FSM	O
leads	O
often	O
to	O
a	O
reduction	O
of	O
the	O
number	O
of	O
states	B-Application
.	O
</s>
<s>
The	O
example	O
in	O
figure	O
7	O
shows	O
a	O
Mealy	B-General_Concept
FSM	O
implementing	O
the	O
same	O
behaviour	O
as	O
in	O
the	O
Moore	O
example	O
(	O
the	O
behaviour	O
depends	O
on	O
the	O
implemented	O
FSM	O
execution	O
model	O
and	O
will	O
work	O
,	O
e.g.	O
,	O
for	O
virtual	B-Application
FSM	I-Application
but	O
not	O
for	O
event-driven	B-Application
FSM	I-Application
)	O
.	O
</s>
<s>
The	O
"	O
opening	O
"	O
and	O
"	O
closing	O
"	O
intermediate	O
states	B-Application
are	O
not	O
shown	O
.	O
</s>
<s>
A	O
further	O
distinction	O
is	O
between	O
deterministic	O
(	O
DFA	B-General_Concept
)	O
and	O
non-deterministic	O
(	O
NFA	B-General_Concept
,	O
GNFA	B-General_Concept
)	O
automata	O
.	O
</s>
<s>
The	O
powerset	B-General_Concept
construction	I-General_Concept
algorithm	O
can	O
transform	O
any	O
nondeterministic	O
automaton	O
into	O
a	O
(	O
usually	O
more	O
complex	O
)	O
deterministic	O
automaton	O
with	O
identical	O
functionality	O
.	O
</s>
<s>
A	O
finite-state	B-Architecture
machine	I-Architecture
with	O
only	O
one	O
state	O
is	O
called	O
a	O
"	O
combinatorial	O
FSM	O
"	O
.	O
</s>
<s>
This	O
concept	O
is	O
useful	O
in	O
cases	O
where	O
a	O
number	O
of	O
finite-state	B-Architecture
machines	I-Architecture
are	O
required	O
to	O
work	O
together	O
,	O
and	O
when	O
it	O
is	O
convenient	O
to	O
consider	O
a	O
purely	O
combinatorial	O
part	O
as	O
a	O
form	O
of	O
FSM	O
to	O
suit	O
the	O
design	O
tools	O
.	O
</s>
<s>
There	O
are	O
other	O
sets	O
of	O
semantics	O
available	O
to	O
represent	O
state	B-Architecture
machines	I-Architecture
.	O
</s>
<s>
They	O
combine	O
hierarchical	B-Application
state	I-Application
machines	I-Application
(	O
which	O
usually	O
have	O
more	O
than	O
one	O
current	O
state	O
)	O
,	O
flow	O
graphs	O
,	O
and	O
truth	O
tables	O
into	O
one	O
language	O
,	O
resulting	O
in	O
a	O
different	O
formalism	O
and	O
set	O
of	O
semantics	O
.	O
</s>
<s>
These	O
charts	O
,	O
like	O
Harel	O
's	O
original	O
state	B-Architecture
machines	I-Architecture
,	O
support	O
hierarchically	O
nested	O
states	B-Application
,	O
orthogonal	O
regions	O
,	O
state	O
actions	O
,	O
and	O
transition	O
actions	O
.	O
</s>
<s>
A	O
deterministic	B-General_Concept
finite-state	I-General_Concept
machine	I-General_Concept
or	O
deterministic	O
finite-state	O
acceptor	O
is	O
a	O
quintuple	B-Application
,	O
where	O
:	O
</s>
<s>
is	O
a	O
finite	O
non-empty	O
set	O
of	O
states	B-Application
;	O
</s>
<s>
is	O
the	O
state-transition	O
function	O
:	O
(	O
in	O
a	O
nondeterministic	B-General_Concept
finite	I-General_Concept
automaton	I-General_Concept
it	O
would	O
be	O
,	O
i.e.	O
</s>
<s>
would	O
return	O
a	O
set	O
of	O
states	B-Application
)	O
;	O
</s>
<s>
is	O
the	O
set	O
of	O
final	O
states	B-Application
,	O
a	O
(	O
possibly	O
empty	O
)	O
subset	O
of	O
.	O
</s>
<s>
For	O
both	O
deterministic	O
and	O
non-deterministic	O
FSMs	O
,	O
it	O
is	O
conventional	O
to	O
allow	O
to	O
be	O
a	O
partial	B-Algorithm
function	I-Algorithm
,	O
i.e.	O
</s>
<s>
This	O
is	O
useful	O
in	O
definitions	O
of	O
general	O
state	B-Architecture
machines	I-Architecture
,	O
but	O
less	O
useful	O
when	O
transforming	O
the	O
machine	O
.	O
</s>
<s>
Some	O
algorithms	O
in	O
their	O
default	O
form	O
may	O
require	O
total	B-Algorithm
functions	I-Algorithm
.	O
</s>
<s>
A	O
finite-state	B-Architecture
machine	I-Architecture
has	O
the	O
same	O
computational	O
power	O
as	O
a	O
Turing	B-Architecture
machine	I-Architecture
that	O
is	O
restricted	O
such	O
that	O
its	O
head	O
may	O
only	O
perform	O
"	O
read	O
"	O
operations	O
,	O
and	O
always	O
has	O
to	O
move	O
from	O
left	O
to	O
right	O
.	O
</s>
<s>
That	O
is	O
,	O
each	O
formal	O
language	O
accepted	O
by	O
a	O
finite-state	B-Architecture
machine	I-Architecture
is	O
accepted	O
by	O
such	O
a	O
kind	O
of	O
restricted	O
Turing	B-Architecture
machine	I-Architecture
,	O
and	O
vice	O
versa	O
.	O
</s>
<s>
A	O
finite-state	B-Architecture
transducer	I-Architecture
is	O
a	O
sextuple	O
,	O
where	O
:	O
</s>
<s>
is	O
a	O
finite	O
non-empty	O
set	O
of	O
states	B-Application
;	O
</s>
<s>
If	O
the	O
output	O
function	O
depends	O
on	O
the	O
state	O
and	O
input	O
symbol	O
(	O
)	O
that	O
definition	O
corresponds	O
to	O
the	O
Mealy	B-General_Concept
model	O
,	O
and	O
can	O
be	O
modelled	O
as	O
a	O
Mealy	B-General_Concept
machine	I-General_Concept
.	O
</s>
<s>
If	O
the	O
output	O
function	O
depends	O
only	O
on	O
the	O
state	O
(	O
)	O
that	O
definition	O
corresponds	O
to	O
the	O
Moore	O
model	O
,	O
and	O
can	O
be	O
modelled	O
as	O
a	O
Moore	B-General_Concept
machine	I-General_Concept
.	O
</s>
<s>
A	O
finite-state	B-Architecture
machine	I-Architecture
with	O
no	O
output	O
function	O
at	O
all	O
is	O
known	O
as	O
a	O
semiautomaton	O
or	O
transition	B-Application
system	I-Application
.	O
</s>
<s>
If	O
we	O
disregard	O
the	O
first	O
output	O
symbol	O
of	O
a	O
Moore	B-General_Concept
machine	I-General_Concept
,	O
,	O
then	O
it	O
can	O
be	O
readily	O
converted	O
to	O
an	O
output-equivalent	O
Mealy	B-General_Concept
machine	I-General_Concept
by	O
setting	O
the	O
output	O
function	O
of	O
every	O
Mealy	B-General_Concept
transition	O
(	O
i.e.	O
</s>
<s>
The	O
converse	O
transformation	O
is	O
less	O
straightforward	O
because	O
a	O
Mealy	B-General_Concept
machine	I-General_Concept
state	O
may	O
have	O
different	O
output	O
labels	O
on	O
its	O
incoming	O
transitions	O
(	O
edges	O
)	O
.	O
</s>
<s>
Every	O
such	O
state	O
needs	O
to	O
be	O
split	O
in	O
multiple	O
Moore	B-General_Concept
machine	I-General_Concept
states	B-Application
,	O
one	O
for	O
every	O
incident	O
output	O
symbol	O
.	O
</s>
<s>
Optimizing	O
an	O
FSM	O
means	O
finding	O
a	O
machine	O
with	O
the	O
minimum	O
number	O
of	O
states	B-Application
that	O
performs	O
the	O
same	O
function	O
.	O
</s>
<s>
Other	O
techniques	O
include	O
using	O
an	O
implication	B-Application
table	I-Application
,	O
or	O
the	O
Moore	O
reduction	O
procedure	O
.	O
</s>
<s>
In	O
a	O
digital	O
circuit	O
,	O
an	O
FSM	O
may	O
be	O
built	O
using	O
a	O
programmable	O
logic	O
device	O
,	O
a	O
programmable	B-Architecture
logic	I-Architecture
controller	I-Architecture
,	O
logic	O
gates	O
and	O
flip	B-General_Concept
flops	I-General_Concept
or	O
relays	O
.	O
</s>
<s>
More	O
specifically	O
,	O
a	O
hardware	O
implementation	O
requires	O
a	O
register	B-General_Concept
to	O
store	O
state	O
variables	O
,	O
a	O
block	O
of	O
combinational	O
logic	O
that	O
determines	O
the	O
state	B-Application
transition	I-Application
,	O
and	O
a	O
second	O
block	O
of	O
combinational	O
logic	O
that	O
determines	O
the	O
output	O
of	O
an	O
FSM	O
.	O
</s>
<s>
One	O
of	O
the	O
classic	O
hardware	O
implementations	O
is	O
the	O
Richards	B-Application
controller	I-Application
.	O
</s>
<s>
In	O
a	O
Medvedev	O
machine	O
,	O
the	O
output	O
is	O
directly	O
connected	O
to	O
the	O
state	O
flip-flops	B-General_Concept
minimizing	O
the	O
time	O
delay	O
between	O
flip-flops	B-General_Concept
and	O
output	O
.	O
</s>
<s>
Through	O
state	B-Application
encoding	I-Application
for	I-Application
low	I-Application
power	I-Application
state	B-Architecture
machines	I-Architecture
may	O
be	O
optimized	O
to	O
minimize	O
power	O
consumption	O
.	O
</s>
<s>
The	O
following	O
concepts	O
are	O
commonly	O
used	O
to	O
build	O
software	O
applications	O
with	O
finite-state	B-Architecture
machines	I-Architecture
:	O
</s>
<s>
Finite	B-Architecture
automata	I-Architecture
are	O
often	O
used	O
in	O
the	O
frontend	O
of	O
programming	B-Language
language	I-Language
compilers	I-Language
.	O
</s>
<s>
Such	O
a	O
frontend	O
may	O
comprise	O
several	O
finite-state	B-Architecture
machines	I-Architecture
that	O
implement	O
a	O
lexical	B-Application
analyzer	I-Application
and	O
a	O
parser	O
.	O
</s>
<s>
Starting	O
from	O
a	O
sequence	O
of	O
characters	O
,	O
the	O
lexical	B-Application
analyzer	I-Application
builds	O
a	O
sequence	O
of	O
language	O
tokens	O
(	O
such	O
as	O
reserved	O
words	O
,	O
literals	O
,	O
and	O
identifiers	O
)	O
from	O
which	O
the	O
parser	O
builds	O
a	O
syntax	O
tree	O
.	O
</s>
<s>
The	O
lexical	B-Application
analyzer	I-Application
and	O
the	O
parser	O
handle	O
the	O
regular	O
and	O
context-free	O
parts	O
of	O
the	O
programming	O
language	O
's	O
grammar	O
.	O
</s>
