1BSD/man6/eyacc.6

Compare this file to the similar file:
Show the results in this format:

.th EYACC VI 8/28/77
.sh NAME
eyacc \- modified yacc allowing much improved error recovery
.sh SYNOPSIS
.bd eyacc
[
.bd \-v
]
[ grammar ]
.sh DESCRIPTION
.it Eyacc
converts a context-free grammar into a set of
tables for a simple automaton which executes an LR(1) parsing
algorithm.
The grammar may be ambiguous;
specified precedence rules are used to break ambiguities.
.s3
The output is
.it y.tab.c,
which must be compiled by the C compiler
and loaded with any other routines
required.
If the
.bd \-v
flag is given, the file
.it y.output
is prepared, which contains a description of the parsing tables
and a report on
conflicts generated by ambiguities in the grammar.
.s3
.it Eyacc
is a slightly but significantly modified version of
.it yacc
(I).
The most important change is that
.it eyacc
fully enumerates test actions in its parser when an error token
is in the look-ahead set.
This prevents the parser from making undesirable reductions
when an error occurs before the error is detected.
.it Eyacc
also uses a different encoding for the action tables to allow the
parser to run faster.
Because of the change in enumerating look-aheads,
there are more frequently a series of ``test'' states
in the parse tables.
For this reason,
test states are encoded as the arithmetic inverse
of the value of the token to be tested for.
This allows a much tighter inner loop in the parser and
more than compensates for the extra tests required.
(Of course, the same change could be made to the tables of
.it yacc
and it would then run significantly faster than
.it eyacc,
but error recovery of the kind performed using
.it eyacc
would not be possible without the enumerated look-aheads.)
.s3
Minor changes to
.it yacc
in 
.it eyacc
include
the recognition of a form-feed as a white space character,
increased table size so as to handle larger grammars,
and a change of the code for the error action (from 0 to 1)
because of the change in the testing outlined above.
For this reason it is not possible to use the standard
.it yacc
library with
.it eyacc.
This would be pointless in any case,
because a different set of recovery routines is needed.
.s3
A document describing the error recovery method used with
.it eyacc
in the Pascal translator
.it pi
(VI)
is in preparation.
.sh "SEE ALSO"
``LR Parsing'', by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974.
.s3
``The YACC Compiler-compiler'', internal memorandum.
.s3
``Practical syntactic error recovery'', by Susan L. Graham and Stephen P. Rhodes,
CACM, November 1975.
.s3
pi (VI), yacc (I)
.sh AUTHOR
S. C. Johnson
.s3
.it Eyacc
modifications by Charles Haley and William Joy.
.sh FILES
y.output
.br
y.tab.c
.br
.sh DIAGNOSTICS
The number of reduce-reduce and shift-reduce conflicts
is reported on the standard output;
a more detailed report is
found in the
.it y.output
file.
.sh BUGS
A
.it eyacc
library
should be available.