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