diff --git a/TODO b/TODO index 3f21d72d..9696ce4a 100644 --- a/TODO +++ b/TODO @@ -33,14 +33,8 @@ Show the counterexamples. This is going to be really hard and/or painful. Unless we play it dumb (little structure). *** Doc --Wcounterexamples, --report=counterexamples - -Use "•" instead of ".". - -*** point, dot -We have too many names. In XML we use "point", in C "dot". A traditional -more accurate name of "item" is "pointed rule", so we should probably prefer -"point" to "dot". +-Wcounterexamples, --report=counterexamples. Don't forget to include +examples about conflicts in the reports. ** Bistromathic - Hitting tab on a line with a syntax error is ugly diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl index 968fe987..a8a5edff 100644 --- a/data/xslt/xml2dot.xsl +++ b/data/xslt/xml2dot.xsl @@ -159,7 +159,7 @@ - + - + @@ -198,14 +198,14 @@ : - + . - + . diff --git a/data/xslt/xml2text.xsl b/data/xslt/xml2text.xsl index dcfca1fd..3d0550dd 100644 --- a/data/xslt/xml2text.xsl +++ b/data/xslt/xml2text.xsl @@ -300,7 +300,7 @@ name="prev-lhs" select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]" /> - + @@ -311,7 +311,7 @@ - + @@ -347,11 +347,11 @@ - + . - + . diff --git a/data/xslt/xml2xhtml.xsl b/data/xslt/xml2xhtml.xsl index 4a30bd84..9e7267e3 100644 --- a/data/xslt/xml2xhtml.xsl +++ b/data/xslt/xml2xhtml.xsl @@ -75,7 +75,7 @@ ol.lower-alpha { list-style-type: lower-alpha; } - .point { + .dot { color: #cc0000; } #footer { @@ -457,7 +457,7 @@ - + @@ -468,7 +468,7 @@ - + @@ -529,14 +529,14 @@ - + - + - + - + diff --git a/doc/bison.texi b/doc/bison.texi index c60897bc..5a81202b 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -8301,7 +8301,7 @@ explicitly. This shift/reduce conflicts occurs in the following situation, where the period denotes the current parsing state: @example -if @var{e1} then if @var{e2} then @var{s1} . else @var{s2} +if @var{e1} then if @var{e2} then @var{s1} • else @var{s2} @end example The conflict involves the reduction of the rule @samp{IF expr THEN @@ -9833,39 +9833,40 @@ and reports the uses of the symbols: @group Terminals, with rules where they appear -$end (0) 0 -'*' (42) 3 -'+' (43) 1 -'-' (45) 2 -'/' (47) 4 -error (256) -NUM (258) 5 -STR (259) + $end (0) 0 + '*' (42) 3 + '+' (43) 1 + '-' (45) 2 + '/' (47) 4 + error (256) + NUM (258) 5 + STR (259) @end group @group Nonterminals, with rules where they appear -$accept (9) - on left: 0 -exp (10) - on left: 1 2 3 4 5, on right: 0 1 2 3 4 + $accept (9) + on left: 0 + exp (10) + on left: 1 2 3 4 5 + on right: 0 1 2 3 4 @end group @end example @noindent @cindex item -@cindex pointed rule -@cindex rule, pointed -Bison then proceeds onto the automaton itself, describing each state -with its set of @dfn{items}, also known as @dfn{pointed rules}. Each -item is a production rule together with a point (@samp{.}) marking -the location of the input cursor. +@cindex dotted rule +@cindex rule, dotted +Bison then proceeds onto the automaton itself, describing each state with +its set of @dfn{items}, also known as @dfn{dotted rules}. Each item is a +production rule together with a point (@samp{.}) marking the location of the +input cursor. @example State 0 - 0 $accept: . exp $end + 0 $accept: • exp $end NUM shift, and go to state 1 @@ -9895,12 +9896,12 @@ you want to see more detail you can invoke @command{bison} with @example State 0 - 0 $accept: . exp $end - 1 exp: . exp '+' exp - 2 | . exp '-' exp - 3 | . exp '*' exp - 4 | . exp '/' exp - 5 | . NUM + 0 $accept: • exp $end + 1 exp: • exp '+' exp + 2 | • exp '-' exp + 3 | • exp '*' exp + 4 | • exp '/' exp + 5 | • NUM NUM shift, and go to state 1 @@ -9913,25 +9914,25 @@ In the state 1@dots{} @example State 1 - 5 exp: NUM . + 5 exp: NUM • $default reduce using rule 5 (exp) @end example @noindent the rule 5, @samp{exp: NUM;}, is completed. Whatever the lookahead token -(@samp{$default}), the parser will reduce it. If it was coming from -State 0, then, after this reduction it will return to state 0, and will -jump to state 2 (@samp{exp: go to state 2}). +(@samp{$default}), the parser will reduce it. If it was coming from State +0, then, after this reduction it will return to state 0, and will jump to +state 2 (@samp{exp: go to state 2}). @example State 2 - 0 $accept: exp . $end - 1 exp: exp . '+' exp - 2 | exp . '-' exp - 3 | exp . '*' exp - 4 | exp . '/' exp + 0 $accept: exp • $end + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp $end shift, and go to state 3 '+' shift, and go to state 4 @@ -9941,12 +9942,11 @@ State 2 @end example @noindent -In state 2, the automaton can only shift a symbol. For instance, -because of the item @samp{exp: exp . '+' exp}, if the lookahead is -@samp{+} it is shifted onto the parse stack, and the automaton -jumps to state 4, corresponding to the item @samp{exp: exp '+' . exp}. -Since there is no default action, any lookahead not listed triggers a syntax -error. +In state 2, the automaton can only shift a symbol. For instance, because of +the item @samp{exp: exp • '+' exp}, if the lookahead is @samp{+} it is +shifted onto the parse stack, and the automaton jumps to state 4, +corresponding to the item @samp{exp: exp '+' • exp}. Since there is no +default action, any lookahead not listed triggers a syntax error. @cindex accepting state The state 3 is named the @dfn{final state}, or the @dfn{accepting @@ -9955,7 +9955,7 @@ state}: @example State 3 - 0 $accept: exp $end . + 0 $accept: exp $end • $default accept @end example @@ -9970,7 +9970,7 @@ the reader. @example State 4 - 1 exp: exp '+' . exp + 1 exp: exp '+' • exp NUM shift, and go to state 1 @@ -9979,7 +9979,7 @@ State 4 State 5 - 2 exp: exp '-' . exp + 2 exp: exp '-' • exp NUM shift, and go to state 1 @@ -9988,7 +9988,7 @@ State 5 State 6 - 3 exp: exp '*' . exp + 3 exp: exp '*' • exp NUM shift, and go to state 1 @@ -9997,7 +9997,7 @@ State 6 State 7 - 4 exp: exp '/' . exp + 4 exp: exp '/' • exp NUM shift, and go to state 1 @@ -10010,11 +10010,11 @@ As was announced in beginning of the report, @samp{State 8 conflicts: @example State 8 - 1 exp: exp . '+' exp - 1 | exp '+' exp . - 2 | exp . '-' exp - 3 | exp . '*' exp - 4 | exp . '/' exp + 1 exp: exp • '+' exp + 1 | exp '+' exp • + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp '*' shift, and go to state 6 '/' shift, and go to state 7 @@ -10052,11 +10052,11 @@ with some set of possible lookahead tokens. When run with @example State 8 - 1 exp: exp . '+' exp - 1 | exp '+' exp . [$end, '+', '-', '/'] - 2 | exp . '-' exp - 3 | exp . '*' exp - 4 | exp . '/' exp + 1 exp: exp • '+' exp + 1 | exp '+' exp • [$end, '+', '-', '/'] + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp '*' shift, and go to state 6 '/' shift, and go to state 7 @@ -10084,11 +10084,11 @@ The remaining states are similar: @group State 9 - 1 exp: exp . '+' exp - 2 | exp . '-' exp - 2 | exp '-' exp . - 3 | exp . '*' exp - 4 | exp . '/' exp + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 2 | exp '-' exp • + 3 | exp • '*' exp + 4 | exp • '/' exp '*' shift, and go to state 6 '/' shift, and go to state 7 @@ -10100,11 +10100,11 @@ State 9 @group State 10 - 1 exp: exp . '+' exp - 2 | exp . '-' exp - 3 | exp . '*' exp - 3 | exp '*' exp . - 4 | exp . '/' exp + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 3 | exp '*' exp • + 4 | exp • '/' exp '/' shift, and go to state 7 @@ -10115,11 +10115,11 @@ State 10 @group State 11 - 1 exp: exp . '+' exp - 2 | exp . '-' exp - 3 | exp . '*' exp - 4 | exp . '/' exp - 4 | exp '/' exp . + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp + 4 | exp '/' exp • '+' shift, and go to state 4 '-' shift, and go to state 5 @@ -10192,9 +10192,9 @@ analysis of the textual report. @subheading Graphical Representation of States -The items (pointed rules) for each state are grouped together in graph nodes. -Their numbering is the same as in the verbose file. See the following points, -about transitions, for examples +The items (dotted rules) for each state are grouped together in graph nodes. +Their numbering is the same as in the verbose file. See the following +points, about transitions, for examples When invoked with @option{--report=lookaheads}, the lookahead tokens, when needed, are shown next to the relevant rule between square brackets as a @@ -10215,7 +10215,7 @@ shift. The following describes a reduction in the @file{rr.output} file: @group State 3 - 1 exp: a . ";" + 1 exp: a • ";" ";" shift, and go to state 6 @end group @@ -10236,8 +10236,8 @@ This is how reductions are represented in the verbose file @file{rr.output}: @example State 1 - 3 a: "0" . [";"] - 4 b: "0" . ["."] + 3 a: "0" • [";"] + 4 b: "0" • ["."] "." reduce using rule 4 (b) $default reduce using rule 3 (a) diff --git a/src/gram.h b/src/gram.h index 7f08e499..02b2dd3e 100644 --- a/src/gram.h +++ b/src/gram.h @@ -229,7 +229,7 @@ print_dot_fallback (unsigned int code _GL_UNUSED, } /* Print "•", the symbol used to represent a point in an item (aka, a - pointed rule). */ + dotted rule). */ static inline void print_dot (FILE *out) { diff --git a/src/print-xml.c b/src/print-xml.c index 168d6bd5..8bb43bb3 100644 --- a/src/print-xml.c +++ b/src/print-xml.c @@ -89,7 +89,7 @@ print_core (FILE *out, int level, state *s) if (reds->lookahead_tokens && red != -1) { xml_printf (out, level + 1, - "", + "", r->number, sp1 - sp); state_rule_lookahead_tokens_print_xml (s, r, out, level + 2); @@ -100,7 +100,7 @@ print_core (FILE *out, int level, state *s) if (!printed) xml_printf (out, level + 1, - "", + "", r->number, sp1 - sp); } diff --git a/tests/report.at b/tests/report.at index 3801c919..9e9f1272 100644 --- a/tests/report.at +++ b/tests/report.at @@ -789,10 +789,10 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - + + + + @@ -809,7 +809,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -823,14 +823,14 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - - - - + + + + + + + + @@ -850,7 +850,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -864,11 +864,11 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - + + + + + @@ -886,12 +886,12 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + ":=" - + "end of file" @@ -910,7 +910,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -924,11 +924,11 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - + + + + + @@ -946,7 +946,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -960,7 +960,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -974,7 +974,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -988,7 +988,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1002,8 +1002,8 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - + + @@ -1019,7 +1019,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1033,11 +1033,11 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - + + + + + @@ -1055,8 +1055,8 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - + + @@ -1072,7 +1072,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1086,7 +1086,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1100,11 +1100,11 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - + + + + + @@ -1122,7 +1122,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1531,12 +1531,12 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - - + + + + + + @@ -1552,7 +1552,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1566,7 +1566,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1580,10 +1580,10 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - + + + + @@ -1599,7 +1599,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - + @@ -1613,13 +1613,13 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - - - + + + + + + + @@ -1635,12 +1635,12 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - - - - + + + + + + @@ -1656,17 +1656,17 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - - + + + $end "+" "⊕" - - + + $end "+" @@ -1696,16 +1696,16 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" - - + + $end "+" "⊕" - - + +