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