1264790SbaptTom Shields, March 17, 2014 2264790Sbapt 3264790SbaptNOTE: README.BTYACC needs to be re-written (or another README file created) 4264790Sbaptto explain how the extensions were adopted into the byacc-20140101 baseline. 5264790Sbapt 6264790Sbaptbytacc changes adopted; see README.BTYACC for details. 7264790Sbapt------------------------------------------------------ 8264790Sbapt 9264790Sbapt Changes to the skeleton to send debugging output to stderr. 10264790Sbapt 11264790Sbapt Changes to the types of the grammar tables from 'short' to 'int' if 12264790SbaptMAXTABLE is defined to be > MAXSHORT for generation of large grammar tables 13264790Sbaptfor large grammars. This can be set with the invocation of configure 14264790Sbaptusing the --with-max-table-size=N option 15264790Sbapt 16264790Sbapt Changes to add syntactic sugaring for definition and semantic processing 17264790Sbaptof inherited attributes associated with non-terminal symbols on the rhs of 18264790Sbaptrules. Inherited attributes are implemented as {}-actions, and as such may 19264790Sbaptintroduce reduce/reduce conflicts. The advantage over manual {}-actions is 20264790Sbaptthat checking is performed on the number and types of inherited attributes, 21264790Sbaptand the positions on the semantic stack are automatically calculated. 22264790SbaptIdentical actions produced by the inherited attribute syntax are collapsed 23264790Sbaptinto a single action, reducing reduce/reduce conflicts. 24264790Sbapt 25264790Sbapt The %type specification is extended to define the types of inherited 26264790Sbaptattributes associated with non-terminal symbols on the lhs of rules, in 27264790Sbaptaddition to its original purpose in yacc for specifying the type of the 28264790Sbaptsymbol itself on the parser's value stack. In order to permit the two 29264790Sbapt aspects to be used independently, the <type> specification following 30264790Sbapt%type is optional. 31264790Sbapt 32264790Sbapt Added a mechanism to the parser skeleton for computing and propagating 33264790Sbaptthe text position of grammar symbols if %locations directive is present in 34264790Sbaptthe grammar specificaion, or if yacc is invoked with the -L flag. Includes 35264790Sbaptsupport for "@$" and "@N" (for N an integer) in actions to refer to symbol 36264790Sbaptlocations. 37264790Sbapt 38264790Sbapt Added a bison compatible %destructor directive to define a memory 39264790Sbaptmanagement mechanism to the parser skeleton that enables cleanup of semantic 40264790Sbaptvalues and text positions associated with the parsing stack that are 41264790Sbaptautomatically discarded during error processing. 42264790Sbapt 43264790SbaptThe following is only available if configure is invoked with the 44264790Sbapt--enable-btyacc=yes: 45264790Sbapt 46264790Sbapt Changes to enable backtracking with semantic disambiguation, if yacc is 47264790Sbaptinvoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts 48264790Sbaptby choosing to shift, and reduce/reduce conflicts by reducing using the 49264790Sbaptearliest grammar rule (in the grammar specification). A btyacc parser handles 50264790Sbapta conflict by remembering the current parse point and entering into trial parse 51264790Sbaptmode. In trial parse mode, the parser tries each of the conflicting options 52264790Sbaptuntil the first successs or until all options are exhausted. If the parser 53264790Sbaptruns into an error while in trial parse mode, it backtracks to the most recent 54264790Sbaptconflict point and tries the next alternative. If the parser finds a 55264790Sbaptsuccessful parse, it backtracks to the point where it first entered trial parse 56264790Sbaptmode and continues with normal parsing, using the action at the start of the 57264790Sbaptsuccessful trial path. Success in trial parse mode is achieved either by 58264790Sbaptsuccessfully reducing the start symbol at the end of input or by invocation of 59264790SbaptYYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within 60264790Sbapt[]-actions, which are always executed, with invocation of YYERROR to terminate 61264790Sbapta trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only 62264790Sbaptexecuted during normal parsing. 63264790Sbapt 64264790Sbapt 65264790Sbaptbtyacc changes deferred: 66264790Sbapt------------------------ 67264790Sbapt 68264790Sbapt The -S command line flag to enable use of an alternate parser skeleton, 69264790Sbaptread from an external file. 70264790Sbapt 71264790Sbapt Preprocessor statements: %define, %ifdef/%endif, %include. 72264790Sbapt 73264790Sbapt 74264790Sbaptbtyacc changes rejected: 75264790Sbapt------------------------ 76264790Sbapt 77264790Sbapt The yyerror_detailed() option for error messages is replaced by the 78264790Sbaptbyacc feature for specifying options paramters to yyerror(). 79264790Sbapt 80264790Sbapt C++-specific features in the parser skeleton. 81