<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
an	O
operator	B-Application
precedence	I-Application
parser	I-Application
is	O
a	O
bottom-up	B-Application
parser	I-Application
that	O
interprets	O
an	O
operator-precedence	O
grammar	O
.	O
</s>
<s>
For	O
example	O
,	O
most	O
calculators	B-Application
use	O
operator	B-Application
precedence	I-Application
parsers	I-Application
to	O
convert	O
from	O
the	O
human-readable	O
infix	O
notation	O
relying	O
on	O
order	O
of	O
operations	O
to	O
a	O
format	O
that	O
is	O
optimized	O
for	O
evaluation	O
such	O
as	O
Reverse	O
Polish	O
notation	O
(	O
RPN	O
)	O
.	O
</s>
<s>
Edsger	O
Dijkstra	O
's	O
shunting	B-Application
yard	I-Application
algorithm	I-Application
is	O
commonly	O
used	O
to	O
implement	O
operator	B-Application
precedence	I-Application
parsers	I-Application
.	O
</s>
<s>
An	O
operator-precedence	B-Application
parser	I-Application
is	O
a	O
simple	O
shift-reduce	B-Application
parser	I-Application
that	O
is	O
capable	O
of	O
parsing	O
a	O
subset	O
of	O
LR(1 )	O
grammars	O
.	O
</s>
<s>
More	O
precisely	O
,	O
the	O
operator-precedence	B-Application
parser	I-Application
can	O
parse	O
all	O
LR(1 )	O
grammars	O
where	O
two	O
consecutive	O
nonterminals	B-Algorithm
and	O
epsilon	O
never	O
appear	O
in	O
the	O
right-hand	O
side	O
of	O
any	O
rule	O
.	O
</s>
<s>
Operator-precedence	B-Application
parsers	I-Application
are	O
not	O
used	O
often	O
in	O
practice	O
;	O
however	O
they	O
do	O
have	O
some	O
properties	O
that	O
make	O
them	O
useful	O
within	O
a	O
larger	O
design	O
.	O
</s>
<s>
First	O
,	O
they	O
are	O
simple	O
enough	O
to	O
write	O
by	O
hand	O
,	O
which	O
is	O
not	O
generally	O
the	O
case	O
with	O
more	O
sophisticated	O
right	O
shift-reduce	B-Application
parsers	I-Application
.	O
</s>
<s>
Second	O
,	O
they	O
can	O
be	O
written	O
to	O
consult	O
an	O
operator	O
table	O
at	O
run	B-Library
time	I-Library
,	O
which	O
makes	O
them	O
suitable	O
for	O
languages	O
that	O
can	O
add	O
to	O
or	O
change	O
their	O
operators	O
while	O
parsing	O
.	O
</s>
<s>
(	O
An	O
example	O
is	O
Haskell	B-Language
,	O
which	O
allows	O
user-defined	O
infix	O
operators	O
with	O
custom	O
associativity	O
and	O
precedence	O
;	O
consequentially	O
,	O
an	O
operator-precedence	B-Application
parser	I-Application
must	O
be	O
run	O
on	O
the	O
program	O
after	O
parsing	O
of	O
all	O
referenced	O
modules	O
.	O
)	O
</s>
<s>
Raku	B-Application
sandwiches	O
an	O
operator-precedence	B-Application
parser	I-Application
between	O
two	O
recursive	B-Application
descent	I-Application
parsers	I-Application
in	O
order	O
to	O
achieve	O
a	O
balance	O
of	O
speed	O
and	O
dynamism	O
.	O
</s>
<s>
GCC	B-Application
's	O
C	O
and	O
C++	O
parsers	O
,	O
which	O
are	O
hand-coded	O
recursive	B-Application
descent	I-Application
parsers	I-Application
,	O
are	O
both	O
sped	O
up	O
by	O
an	O
operator-precedence	B-Application
parser	I-Application
that	O
can	O
quickly	O
examine	O
arithmetic	O
expressions	O
.	O
</s>
<s>
Operator	B-Application
precedence	I-Application
parsers	I-Application
are	O
also	O
embedded	O
within	O
compiler-compiler-generated	O
parsers	O
to	O
noticeably	O
speed	O
up	O
the	O
recursive	B-Application
descent	I-Application
approach	O
to	O
expression	O
parsing	O
.	O
</s>
<s>
The	O
precedence	B-Application
climbing	I-Application
method	O
is	O
a	O
compact	O
,	O
efficient	O
,	O
and	O
flexible	O
algorithm	O
for	O
parsing	O
expressions	O
that	O
was	O
first	O
described	O
by	O
Martin	O
Richards	O
and	O
Colin	O
Whitby-Strevens	O
.	O
</s>
<s>
With	O
many	O
levels	O
of	O
precedence	O
,	O
implementing	O
this	O
grammar	O
with	O
a	O
predictive	O
recursive-descent	B-Application
parser	I-Application
can	O
become	O
inefficient	O
.	O
</s>
<s>
Parsing	O
a	O
number	O
,	O
for	O
example	O
,	O
can	O
require	O
five	O
function	O
calls	O
:	O
one	O
for	O
each	O
non-terminal	B-Algorithm
in	O
the	O
grammar	O
until	O
reaching	O
primary	O
.	O
</s>
<s>
An	O
operator-precedence	B-Application
parser	I-Application
can	O
do	O
the	O
same	O
more	O
efficiently	O
.	O
</s>
<s>
The	O
algorithm	O
is	O
not	O
a	O
pure	O
operator-precedence	B-Application
parser	I-Application
like	O
the	O
Dijkstra	O
shunting	B-Application
yard	I-Application
algorithm	I-Application
.	O
</s>
<s>
It	O
assumes	O
that	O
the	O
primary	O
nonterminal	B-Algorithm
is	O
parsed	O
in	O
a	O
separate	O
subroutine	O
,	O
like	O
in	O
a	O
recursive	B-Application
descent	I-Application
parser	I-Application
.	O
</s>
<s>
Another	O
precedence	O
parser	O
known	O
as	O
Pratt	O
parsing	O
was	O
first	O
described	O
by	O
Vaughan	O
Pratt	O
in	O
the	O
1973	O
paper	O
"	O
Top	O
down	O
operator	O
precedence	O
"	O
,	O
based	O
on	O
recursive	B-Application
descent	I-Application
.	O
</s>
<s>
Though	O
it	O
predates	O
precedence	B-Application
climbing	I-Application
,	O
it	O
can	O
be	O
viewed	O
as	O
a	O
generalization	O
of	O
precedence	B-Application
climbing	I-Application
.	O
</s>
<s>
Pratt	O
designed	O
the	O
parser	O
originally	O
to	O
implement	O
the	O
CGOL	B-Language
programming	O
language	O
,	O
and	O
it	O
was	O
treated	O
in	O
much	O
more	O
depth	O
in	O
a	O
Masters	O
Thesis	O
under	O
his	O
supervision	O
.	O
</s>
<s>
Douglas	O
Crockford	O
based	O
the	O
JavaScript	O
parser	O
in	O
JSLint	B-Language
on	O
Pratt	O
parsing	O
.	O
</s>
<s>
Comparison	O
between	O
Python	B-Language
implementations	O
of	O
precedence	B-Application
climbing	I-Application
and	O
Pratt	O
parsing	O
:	O
</s>
<s>
Tutorial	O
using	O
Rust	B-Application
:	O
</s>
<s>
Tutorial	O
using	O
Python	B-Language
:	O
</s>
<s>
Tutorial	O
using	O
Java	B-Language
:	O
</s>
