EYACC(1) UNIX Programmer's Manual EYACC(1) NAME eyacc - modified yacc allowing much improved error recovery SYNOPSIS eyacc [ -v ] [ grammar ] DESCRIPTION _E_y_a_c_c converts a context-free grammar into a set of tables for a simple automaton which executes an LR(1) parsing algo- rithm. The grammar may be ambiguous; specified precedence rules are used to break ambiguities. The output is _y._t_a_b._c, which must be compiled by the C com- piler and loaded with any other routines required. If the -v flag is given, the file _y._o_u_t_p_u_t is prepared, which con- tains a description of the parsing tables and a report on conflicts generated by ambiguities in the grammar. _E_y_a_c_c is a slight but significant modification of an old version of _y_a_c_c(1). The most important change is that _e_y_a_c_c 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. _E_y_a_c_c 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 _y_a_c_c and it would then run significantly faster than _e_y_a_c_c, but error recovery of the kind performed using _e_y_a_c_c would not be possible without the enumerated look- aheads.) Minor changes to _y_a_c_c in _e_y_a_c_c 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 pos- sible to use the standard _y_a_c_c library with _e_y_a_c_c. This would be pointless in any case, because a different set of recovery routines is needed. SEE ALSO `LR Parsing', by A. V. Aho and S. C. Johnson, Computing Sur- veys, June, 1974. `The YACC Compiler-compiler', internal memorandum. Printed 5/16/83 1 EYACC(1) UNIX Programmer's Manual EYACC(1) `Practical syntactic error recovery', by Susan L. Graham and Stephen P. Rhodes, CACM, November 1975. pi(1), yacc(1) AUTHOR S. C. Johnson _E_y_a_c_c modifications by Charles Haley and William Joy. FILES y.output y.tab.c DIAGNOSTICS The number of reduce-reduce and shift-reduce conflicts is reported on the standard output; a more detailed report is found in the _y._o_u_t_p_u_t file. BUGS An _e_y_a_c_c library should be available. Printed 5/16/83 2