Tom Shields, March 17, 2014 NOTE: README.BTYACC needs to be re-written (or another README file created) to explain how the extensions were adopted into the byacc-20140101 baseline. bytacc changes adopted; see README.BTYACC for details. ------------------------------------------------------ Changes to the skeleton to send debugging output to stderr. Changes to the types of the grammar tables from 'short' to 'int' if MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables for large grammars. This can be set with the invocation of configure using the --with-max-table-size=N option Changes to add syntactic sugaring for definition and semantic processing of inherited attributes associated with non-terminal symbols on the rhs of rules. Inherited attributes are implemented as {}-actions, and as such may introduce reduce/reduce conflicts. The advantage over manual {}-actions is that checking is performed on the number and types of inherited attributes, and the positions on the semantic stack are automatically calculated. Identical actions produced by the inherited attribute syntax are collapsed into a single action, reducing reduce/reduce conflicts. The %type specification is extended to define the types of inherited attributes associated with non-terminal symbols on the lhs of rules, in addition to its original purpose in yacc for specifying the type of the symbol itself on the parser's value stack. In order to permit the two aspects to be used independently, the specification following %type is optional. Added a mechanism to the parser skeleton for computing and propagating the text position of grammar symbols if %locations directive is present in the grammar specificaion, or if yacc is invoked with the -L flag. Includes support for "@$" and "@N" (for N an integer) in actions to refer to symbol locations. Added a bison compatible %destructor directive to define a memory management mechanism to the parser skeleton that enables cleanup of semantic values and text positions associated with the parsing stack that are automatically discarded during error processing. The following is only available if configure is invoked with the --enable-btyacc=yes: Changes to enable backtracking with semantic disambiguation, if yacc is invoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts by choosing to shift, and reduce/reduce conflicts by reducing using the earliest grammar rule (in the grammar specification). A btyacc parser handles a conflict by remembering the current parse point and entering into trial parse mode. In trial parse mode, the parser tries each of the conflicting options until the first successs or until all options are exhausted. If the parser runs into an error while in trial parse mode, it backtracks to the most recent conflict point and tries the next alternative. If the parser finds a successful parse, it backtracks to the point where it first entered trial parse mode and continues with normal parsing, using the action at the start of the successful trial path. Success in trial parse mode is achieved either by successfully reducing the start symbol at the end of input or by invocation of YYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within []-actions, which are always executed, with invocation of YYERROR to terminate a trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only executed during normal parsing. btyacc changes deferred: ------------------------ The -S command line flag to enable use of an alternate parser skeleton, read from an external file. Preprocessor statements: %define, %ifdef/%endif, %include. btyacc changes rejected: ------------------------ The yyerror_detailed() option for error messages is replaced by the byacc feature for specifying options paramters to yyerror(). C++-specific features in the parser skeleton.