1Tom Shields, March 17, 2014 2 3NOTE: README.BTYACC needs to be re-written (or another README file created) 4to explain how the extensions were adopted into the byacc-20140101 baseline. 5 6bytacc changes adopted; see README.BTYACC for details. 7------------------------------------------------------ 8 9 Changes to the skeleton to send debugging output to stderr. 10 11 Changes to the types of the grammar tables from 'short' to 'int' if 12MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables 13for large grammars. This can be set with the invocation of configure 14using the --with-max-table-size=N option 15 16 Changes to add syntactic sugaring for definition and semantic processing 17of inherited attributes associated with non-terminal symbols on the rhs of 18rules. Inherited attributes are implemented as {}-actions, and as such may 19introduce reduce/reduce conflicts. The advantage over manual {}-actions is 20that checking is performed on the number and types of inherited attributes, 21and the positions on the semantic stack are automatically calculated. 22Identical actions produced by the inherited attribute syntax are collapsed 23into a single action, reducing reduce/reduce conflicts. 24 25 The %type specification is extended to define the types of inherited 26attributes associated with non-terminal symbols on the lhs of rules, in 27addition to its original purpose in yacc for specifying the type of the 28symbol itself on the parser's value stack. In order to permit the two 29 aspects to be used independently, the <type> specification following 30%type is optional. 31 32 Added a mechanism to the parser skeleton for computing and propagating 33the text position of grammar symbols if %locations directive is present in 34the grammar specificaion, or if yacc is invoked with the -L flag. Includes 35support for "@$" and "@N" (for N an integer) in actions to refer to symbol 36locations. 37 38 Added a bison compatible %destructor directive to define a memory 39management mechanism to the parser skeleton that enables cleanup of semantic 40values and text positions associated with the parsing stack that are 41automatically discarded during error processing. 42 43The following is only available if configure is invoked with the 44--enable-btyacc=yes: 45 46 Changes to enable backtracking with semantic disambiguation, if yacc is 47invoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts 48by choosing to shift, and reduce/reduce conflicts by reducing using the 49earliest grammar rule (in the grammar specification). A btyacc parser handles 50a conflict by remembering the current parse point and entering into trial parse 51mode. In trial parse mode, the parser tries each of the conflicting options 52until the first successs or until all options are exhausted. If the parser 53runs into an error while in trial parse mode, it backtracks to the most recent 54conflict point and tries the next alternative. If the parser finds a 55successful parse, it backtracks to the point where it first entered trial parse 56mode and continues with normal parsing, using the action at the start of the 57successful trial path. Success in trial parse mode is achieved either by 58successfully reducing the start symbol at the end of input or by invocation of 59YYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within 60[]-actions, which are always executed, with invocation of YYERROR to terminate 61a trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only 62executed during normal parsing. 63 64 65btyacc changes deferred: 66------------------------ 67 68 The -S command line flag to enable use of an alternate parser skeleton, 69read from an external file. 70 71 Preprocessor statements: %define, %ifdef/%endif, %include. 72 73 74btyacc changes rejected: 75------------------------ 76 77 The yyerror_detailed() option for error messages is replaced by the 78byacc feature for specifying options paramters to yyerror(). 79 80 C++-specific features in the parser skeleton. 81