BSD 3 development
[unix-history] / .ref-BSD-2 / man / eyacc.u
CommitLineData
bacb3fbd
CH
1.TH EYACC UCB 8/28/77
2.SH NAME
3eyacc \- modified yacc allowing much improved error recovery
4.SH SYNOPSIS
5.B eyacc
6[
7.B \-v
8]
9[ grammar ]
10.SH DESCRIPTION
11.I Eyacc
12converts a context-free grammar into a set of
13tables for a simple automaton which executes an LR(1) parsing
14algorithm.
15The grammar may be ambiguous;
16specified precedence rules are used to break ambiguities.
17.PP
18The output is
19.I y.tab.c,
20which must be compiled by the C compiler
21and loaded with any other routines
22required.
23If the
24.B \-v
25flag is given, the file
26.I y.output
27is prepared, which contains a description of the parsing tables
28and a report on
29conflicts generated by ambiguities in the grammar.
30.PP
31.I Eyacc
32is a slightly but significantly modification of an old version of
33.IR yacc (1).
34The most important change is that
35.I eyacc
36fully enumerates test actions in its parser when an error token
37is in the look-ahead set.
38This prevents the parser from making undesirable reductions
39when an error occurs before the error is detected.
40.I Eyacc
41also uses a different encoding for the action tables to allow the
42parser to run faster.
43Because of the change in enumerating look-aheads,
44there are more frequently a series of `test' states
45in the parse tables.
46For this reason,
47test states are encoded as the arithmetic inverse
48of the value of the token to be tested for.
49This allows a much tighter inner loop in the parser and
50more than compensates for the extra tests required.
51(Of course, the same change could be made to the tables of
52.I yacc
53and it would then run significantly faster than
54.I eyacc,
55but error recovery of the kind performed using
56.I eyacc
57would not be possible without the enumerated look-aheads.)
58.PP
59Minor changes to
60.I yacc
61in
62.I eyacc
63include
64the recognition of a form-feed as a white space character,
65increased table size so as to handle larger grammars,
66and a change of the code for the error action (from 0 to 1)
67because of the change in the testing outlined above.
68For this reason it is not possible to use the standard
69.I yacc
70library with
71.I eyacc.
72This would be pointless in any case,
73because a different set of recovery routines is needed.
74.SH "SEE ALSO"
75`LR Parsing', by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974.
76.PP
77`The YACC Compiler-compiler', internal memorandum.
78.PP
79`Practical syntactic error recovery', by Susan L. Graham and Stephen P. Rhodes,
80CACM, November 1975.
81.PP
82pi(UCB), yacc(1)
83.SH AUTHOR
84S. C. Johnson
85.PP
86.I Eyacc
87modifications by Charles Haley and William Joy.
88.SH FILES
89y.output
90.br
91y.tab.c
92.br
93.SH DIAGNOSTICS
94The number of reduce-reduce and shift-reduce conflicts
95is reported on the standard output;
96a more detailed report is
97found in the
98.I y.output
99file.
100.SH BUGS
101A
102.I eyacc
103library
104should be available.
105
106