<s>
A	O
GLR	B-Application
parser	I-Application
(	O
GLR	O
standing	O
for	O
"	O
Generalized	O
LR	O
"	O
,	O
where	O
L	O
stands	O
for	O
"	O
left-to-right	O
"	O
and	O
R	O
stands	O
for	O
"	O
rightmost	O
(	O
derivation	O
)	O
"	O
)	O
is	O
an	O
extension	O
of	O
an	O
LR	B-Application
parser	I-Application
algorithm	O
to	O
handle	O
non-deterministic	O
and	O
ambiguous	O
grammars	O
.	O
</s>
<s>
The	O
first	O
actual	O
implementation	O
of	O
GLR	O
was	O
described	O
in	O
a	O
1984	O
paper	O
by	O
Masaru	O
Tomita	O
,	O
it	O
has	O
also	O
been	O
referred	O
to	O
as	O
a	O
"	O
parallel	B-Application
parser	I-Application
"	O
.	O
</s>
<s>
Tomita	O
presented	O
five	O
stages	O
in	O
his	O
original	O
work	O
,	O
though	O
in	O
practice	O
it	O
is	O
the	O
second	O
stage	O
that	O
is	O
recognized	O
as	O
the	O
GLR	B-Application
parser	I-Application
.	O
</s>
<s>
As	O
shown	O
by	O
an	O
earlier	O
publication	O
,	O
Lang	O
was	O
primarily	O
interested	O
in	O
more	O
easily	O
used	O
and	O
more	O
flexible	O
parsers	O
for	O
extensible	B-Application
programming	I-Application
languages	I-Application
.	O
</s>
<s>
Standard	O
LR	B-Application
parsers	I-Application
cannot	O
accommodate	O
the	O
nondeterministic	O
and	O
ambiguous	O
nature	O
of	O
natural	O
language	O
,	O
and	O
the	O
GLR	O
algorithm	O
can	O
.	O
</s>
<s>
Briefly	O
,	O
the	O
GLR	O
algorithm	O
works	O
in	O
a	O
manner	O
similar	O
to	O
the	O
LR	B-Application
parser	I-Application
algorithm	O
,	O
except	O
that	O
,	O
given	O
a	O
particular	O
grammar	O
,	O
a	O
GLR	B-Application
parser	I-Application
will	O
process	O
all	O
possible	O
interpretations	O
of	O
a	O
given	O
input	O
in	O
a	O
breadth-first	B-Algorithm
search	I-Algorithm
.	O
</s>
<s>
On	O
the	O
front-end	O
,	O
a	O
GLR	B-Application
parser	I-Application
generator	O
converts	O
an	O
input	O
grammar	O
into	O
parser	O
tables	O
,	O
in	O
a	O
manner	O
similar	O
to	O
an	O
LR	O
generator	O
.	O
</s>
<s>
However	O
,	O
where	O
LR	O
parse	O
tables	O
allow	O
for	O
only	O
one	O
state	B-Application
transition	I-Application
(	O
given	O
a	O
state	O
and	O
an	O
input	O
token	O
)	O
,	O
GLR	O
parse	O
tables	O
allow	O
for	O
multiple	O
transitions	O
.	O
</s>
<s>
A	O
crucial	O
optimization	O
known	O
as	O
a	O
Graph-structured	B-Data_Structure
stack	I-Data_Structure
(	O
GSS	O
)	O
allows	O
sharing	O
of	O
common	O
prefixes	O
and	O
suffixes	O
of	O
these	O
stacks	O
,	O
which	O
constrains	O
the	O
overall	O
search	O
space	O
and	O
memory	O
usage	O
required	O
to	O
parse	O
input	O
text	O
.	O
</s>
<s>
Recognition	O
using	O
the	O
GLR	O
algorithm	O
has	O
the	O
same	O
worst-case	O
time	O
complexity	O
as	O
the	O
CYK	B-Application
algorithm	I-Application
and	O
Earley	B-Algorithm
algorithm	I-Algorithm
:	O
O(n3 )	O
.	O
</s>
<s>
Compared	O
to	O
other	O
algorithms	O
capable	O
of	O
handling	O
the	O
full	O
class	O
of	O
context-free	O
grammars	O
(	O
such	O
as	O
Earley	O
or	O
CYK	B-Application
)	O
,	O
the	O
GLR	O
algorithm	O
gives	O
better	O
performance	O
on	O
these	O
"	O
nearly	O
deterministic	O
"	O
grammars	O
,	O
because	O
only	O
a	O
single	O
stack	O
will	O
be	O
active	O
during	O
the	O
majority	O
of	O
the	O
parsing	O
process	O
.	O
</s>
<s>
GLR	O
can	O
be	O
combined	O
with	O
the	O
LALR(1 )	O
algorithm	O
,	O
in	O
a	O
hybrid	O
parser	O
,	O
allowing	O
still	O
higher	O
performance	O
.	O
</s>
