<s>
Yacc	B-Application
(	O
Yet	O
Another	O
Compiler-Compiler	B-Language
)	O
is	O
a	O
computer	B-Application
program	I-Application
for	O
the	O
Unix	B-Application
operating	I-Application
system	I-Application
developed	O
by	O
Stephen	O
C	B-Language
.	O
Johnson	O
.	O
</s>
<s>
It	O
is	O
a	O
Look	O
Ahead	O
Left-to-Right	O
Rightmost	O
Derivation	O
(	O
LALR	B-Application
)	O
parser	B-Language
generator	I-Language
,	O
generating	O
a	O
LALR	B-Application
parser	I-Application
(	O
the	O
part	O
of	O
a	O
compiler	B-Language
that	O
tries	O
to	O
make	O
syntactic	O
sense	O
of	O
the	O
source	O
code	O
)	O
based	O
on	O
a	O
formal	O
grammar	O
,	O
written	O
in	O
a	O
notation	O
similar	O
to	O
Backus	O
–	O
Naur	O
Form	O
(	O
BNF	O
)	O
.	O
</s>
<s>
Yacc	B-Application
is	O
supplied	O
as	O
a	O
standard	O
utility	O
on	O
BSD	O
and	O
AT&T	O
Unix	B-Application
.	O
</s>
<s>
GNU-based	O
Linux	B-Application
distributions	O
include	O
Bison	B-Application
,	O
a	O
forward-compatible	B-General_Concept
Yacc	B-Application
replacement	O
.	O
</s>
<s>
In	O
the	O
early	O
1970s	O
,	O
Stephen	O
C	B-Language
.	O
Johnson	O
,	O
a	O
computer	O
scientist	O
at	O
Bell	O
Labs	O
/	O
AT&T	O
,	O
developed	O
Yacc	B-Application
because	O
he	O
wanted	O
to	O
insert	O
an	O
exclusive	O
or	O
operator	O
into	O
a	O
B	B-Language
language	I-Language
compiler	B-Language
(	O
developed	O
using	O
McIlroy	O
's	O
TMG	B-Application
compiler-compiler	B-Language
)	O
,	O
but	O
it	O
turned	O
out	O
to	O
be	O
a	O
hard	O
task	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
he	O
was	O
directed	O
by	O
his	O
colleague	O
at	O
Bell	O
Labs	O
Al	O
Aho	O
to	O
Donald	O
Knuth	O
's	O
work	O
on	O
LR	B-Application
parsing	I-Application
,	O
which	O
served	O
as	O
the	O
basis	O
for	O
Yacc	B-Application
.	O
</s>
<s>
Yacc	B-Application
was	O
influenced	O
by	O
and	O
received	O
its	O
name	O
in	O
reference	O
to	O
TMG	B-Application
compiler-compiler	B-Language
.	O
</s>
<s>
Yacc	B-Application
was	O
originally	O
written	O
in	O
the	O
B	B-Language
programming	I-Language
language	I-Language
,	O
but	O
was	O
soon	O
rewritten	O
in	O
C	B-Language
by	O
Alan	O
Snyder	O
.	O
</s>
<s>
It	O
appeared	O
as	O
part	O
of	O
Version	B-Operating_System
3	I-Operating_System
Unix	I-Operating_System
,	O
and	O
a	O
full	O
description	O
of	O
Yacc	B-Application
was	O
published	O
in	O
1975	O
.	O
</s>
<s>
Johnson	O
used	O
Yacc	B-Application
to	O
create	O
the	O
Portable	B-Application
C	I-Application
Compiler	I-Application
.	O
</s>
<s>
Bjarne	O
Stroustrup	O
also	O
attempted	O
to	O
use	O
Yacc	B-Application
to	O
create	O
a	O
formal	O
specification	O
of	O
C++	B-Language
,	O
but	O
"	O
was	O
defeated	O
by	O
C	B-Language
's	O
syntax	O
"	O
.	O
</s>
<s>
While	O
finding	O
it	O
unsuitable	O
for	O
a	O
formal	O
specification	O
of	O
the	O
language	O
,	O
Stroustrup	O
did	O
proceed	O
to	O
use	O
Yacc	B-Application
to	O
implement	O
Cfront	B-Device
,	O
the	O
first	O
implementation	O
of	O
C++	B-Language
.	O
</s>
<s>
In	O
a	O
2008	O
interview	O
,	O
Johnson	O
reflected	O
that	O
"	O
the	O
contribution	O
Yacc	B-Application
made	O
to	O
the	O
spread	O
of	O
Unix	B-Application
and	O
C	B-Language
is	O
what	O
I	O
'm	O
proudest	O
of	O
"	O
.	O
</s>
<s>
The	O
input	O
to	O
Yacc	B-Application
is	O
a	O
grammar	O
with	O
snippets	O
of	O
C	B-Language
code	O
(	O
called	O
"	O
actions	O
"	O
)	O
attached	O
to	O
its	O
rules	O
.	O
</s>
<s>
Its	O
output	O
is	O
a	O
shift-reduce	B-Application
parser	I-Application
in	O
C	B-Language
that	O
executes	O
the	O
C	B-Language
snippets	O
associated	O
with	O
each	O
rule	O
as	O
soon	O
as	O
the	O
rule	O
is	O
recognized	O
.	O
</s>
<s>
The	O
special	O
identifiers	O
,	O
and	O
refer	O
to	O
items	O
on	O
the	O
parser	O
's	O
stack	B-Application
.	O
</s>
<s>
Yacc	B-Application
produces	O
only	O
a	O
parser	O
(	O
phrase	O
analyzer	O
)	O
;	O
for	O
full	O
syntactic	O
analysis	O
this	O
requires	O
an	O
external	O
lexical	B-Application
analyzer	I-Application
to	O
perform	O
the	O
first	O
tokenization	O
stage	O
(	O
word	O
analysis	O
)	O
,	O
which	O
is	O
then	O
followed	O
by	O
the	O
parsing	O
stage	O
proper	O
.	O
</s>
<s>
Lexical	B-Application
analyzer	I-Application
generators	O
,	O
such	O
as	O
Lex	B-General_Concept
or	O
Flex	B-General_Concept
,	O
are	O
widely	O
available	O
.	O
</s>
<s>
The	O
IEEE	O
POSIX	O
P1003.2	O
standard	O
defines	O
the	O
functionality	O
and	O
requirements	O
for	O
both	O
Lex	B-General_Concept
and	O
Yacc	B-Application
.	O
</s>
<s>
Some	O
versions	O
of	O
AT&T	O
Yacc	B-Application
have	O
become	O
open	B-Application
source	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
source	O
code	O
is	O
available	O
with	O
the	O
standard	O
distributions	O
of	O
Plan	B-Operating_System
9	I-Operating_System
.	O
</s>
<s>
Yacc	B-Application
and	O
similar	O
programs	O
(	O
largely	O
reimplementations	O
)	O
have	O
been	O
very	O
popular	O
.	O
</s>
<s>
Yacc	B-Application
itself	O
used	O
to	O
be	O
available	O
as	O
the	O
default	O
parser	B-Language
generator	I-Language
on	O
most	O
Unix	B-Application
systems	I-Application
,	O
though	O
it	O
has	O
since	O
been	O
supplanted	O
by	O
more	O
recent	O
,	O
largely	O
compatible	O
,	O
programs	O
such	O
as	O
Berkeley	B-Language
Yacc	I-Language
,	O
GNU	B-Application
Bison	I-Application
,	O
MKS	O
Yacc	B-Application
,	O
and	O
Abraxas	O
PCYACC	O
.	O
</s>
<s>
An	O
updated	O
version	O
of	O
the	O
original	O
AT&T	O
Yacc	B-Application
is	O
included	O
as	O
part	O
of	O
Sun	O
's	O
OpenSolaris	B-Operating_System
project	O
.	O
</s>
<s>
Each	O
offers	O
slight	O
improvements	O
and	O
additional	O
features	O
over	O
the	O
original	O
Yacc	B-Application
,	O
but	O
the	O
concept	O
and	O
basic	O
syntax	O
have	O
remained	O
the	O
same	O
.	O
</s>
<s>
Among	O
the	O
languages	O
that	O
were	O
first	O
implemented	O
with	O
Yacc	B-Application
are	O
AWK	B-Application
,	O
C++	B-Language
,	O
eqn	B-Application
and	O
Pic	B-Language
.	O
</s>
<s>
Yacc	B-Application
was	O
also	O
used	O
on	O
Unix	B-Application
to	O
implement	O
the	O
Portable	B-Application
C	I-Application
Compiler	I-Application
,	O
as	O
well	O
as	O
parsers	O
for	O
such	O
programming	O
languages	O
as	O
FORTRAN	O
77	O
,	O
Ratfor	B-Language
,	O
APL	B-Language
,	O
bc	B-Application
,	O
m4	B-Device
,	O
etc	O
.	O
</s>
<s>
Yacc	B-Application
has	O
also	O
been	O
rewritten	O
for	O
other	O
languages	O
,	O
including	O
OCaml	B-Language
,	O
Ratfor	B-Language
,	O
ML	B-Language
,	O
Ada	B-Language
,	O
Pascal	B-Application
,	O
Java	B-Language
,	O
Python	B-Language
,	O
Ruby	B-Language
,	O
Go	B-Application
,	O
Common	B-Language
Lisp	I-Language
and	O
Erlang	B-Operating_System
.	O
</s>
<s>
Berkeley	B-Language
Yacc	I-Language
:	O
The	O
Berkeley	O
implementation	O
of	O
Yacc	B-Application
quickly	O
became	O
more	O
popular	O
than	O
AT&T	O
Yacc	B-Application
itself	O
because	O
of	O
its	O
performance	O
and	O
lack	O
of	O
reuse	O
restrictions	O
.	O
</s>
<s>
LALR	B-Application
parser	I-Application
:	O
The	O
underlying	O
parsing	O
algorithm	O
in	O
Yacc-generated	O
parsers	O
.	O
</s>
<s>
Bison	B-Application
:	O
The	O
GNU	B-Operating_System
version	O
of	O
Yacc	B-Application
.	O
</s>
<s>
Lex	B-General_Concept
(	O
and	O
Flex	B-General_Concept
lexical	I-General_Concept
analyser	I-General_Concept
)	O
,	O
a	O
token	O
parser	O
commonly	O
used	O
in	O
conjunction	O
with	O
Yacc	B-Application
(	O
and	O
Bison	B-Application
)	O
.	O
</s>
<s>
PLY	B-Language
(	O
Python	B-Language
Lex-Yacc	I-Language
)	O
is	O
an	O
alternative	O
implementation	O
of	O
Lex	B-General_Concept
and	O
Yacc	B-Application
in	O
Python	B-Language
.	O
</s>
