mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
cex: prefer → to ::=
It does not make a lot of sense to use ::= in our counterexamples, that's not something that belongs to the Bison "vocabulary". Using the colon makes sense, but it's too discreet. Let's use the arrow, which we already use in some reports (HTML and Dot). * src/gram.h (print_dot_fallback): Generalize into... (print_fallback): this. (print_arrow): New. * src/derivation.c: Use it. * NEWS, tests/conflicts.at, tests/counterexample.at, * tests/diagnostics.at, tests/report.at: Adjust. * doc/bison.texi: Ditto. Unfortunately the literal `→` is output as `↦`. So we need to use @arrow.
This commit is contained in:
8
NEWS
8
NEWS
@@ -45,8 +45,8 @@ GNU Bison NEWS
|
|||||||
conflict. For example:
|
conflict. For example:
|
||||||
|
|
||||||
Example exp '+' exp • '/' exp
|
Example exp '+' exp • '/' exp
|
||||||
First derivation exp ::=[ exp ::=[ exp '+' exp • ] '/' exp ]
|
First derivation exp → [ exp → [ exp '+' exp • ] '/' exp ]
|
||||||
Second derivation exp ::=[ exp '+' exp ::=[ exp • '/' exp ] ]
|
Second derivation exp → [ exp '+' exp → [ exp • '/' exp ] ]
|
||||||
|
|
||||||
When Bison is installed with text styling enabled, the example is actually
|
When Bison is installed with text styling enabled, the example is actually
|
||||||
shown twice, with colors highlighting the ambiguity.
|
shown twice, with colors highlighting the ambiguity.
|
||||||
@@ -57,9 +57,9 @@ GNU Bison NEWS
|
|||||||
generates two examples that are the same up until the dot:
|
generates two examples that are the same up until the dot:
|
||||||
|
|
||||||
First example expr • ID $end
|
First example expr • ID $end
|
||||||
First derivation $accept ::=[ s ::=[ a ::=[ expr • ] ID ] $end ]
|
First derivation $accept → [ s → [ a → [ expr • ] ID ] $end ]
|
||||||
Second example expr • ID ',' ID $end
|
Second example expr • ID ',' ID $end
|
||||||
Second derivation $accept ::=[ s ::=[ a ::=[ expr ::=[ expr • ID ',' ] ] ID ] $end ]
|
Second derivation $accept → [ s → [ a → [ expr → [ expr • ID ',' ] ] ID ] $end ]
|
||||||
|
|
||||||
In these cases, the parser usually doesn't have enough lookahead to
|
In these cases, the parser usually doesn't have enough lookahead to
|
||||||
differentiate the two given examples.
|
differentiate the two given examples.
|
||||||
|
|||||||
@@ -9937,9 +9937,9 @@ output is actually in color)}:
|
|||||||
Shift/reduce conflict on token "else":
|
Shift/reduce conflict on token "else":
|
||||||
@group
|
@group
|
||||||
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||||
First derivation @yellow{if_stmt ::=[ "if" expr "then"} @green{stmt ::=[} @blue{if_stmt ::=[ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
First derivation @yellow{if_stmt @arrow [ "if" expr "then"} @green{stmt @arrow [} @blue{if_stmt @arrow [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
||||||
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||||
Second derivation @yellow{if_stmt ::=[ "if" expr "then"} @green{stmt ::=[} @blue{if_stmt ::=[ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
Second derivation @yellow{if_stmt @arrow [ "if" expr "then"} @green{stmt @arrow [} @blue{if_stmt @arrow [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@end ifhtml
|
@end ifhtml
|
||||||
@@ -9950,11 +9950,11 @@ Shift/reduce conflict on token "else":
|
|||||||
Example
|
Example
|
||||||
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||||
First derivation
|
First derivation
|
||||||
@yellow{if_stmt ::=[ "if" expr "then"} @green{stmt ::=[} @blue{if_stmt ::=[ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
@yellow{if_stmt @arrow [ "if" expr "then"} @green{stmt @arrow [} @blue{if_stmt @arrow [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
||||||
Example
|
Example
|
||||||
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||||
Second derivation
|
Second derivation
|
||||||
@yellow{if_stmt ::=[ "if" expr "then"} @green{stmt ::=[} @blue{if_stmt ::=[ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
@yellow{if_stmt @arrow [ "if" expr "then"} @green{stmt @arrow [} @blue{if_stmt @arrow [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
||||||
@end group
|
@end group
|
||||||
@end smallexample
|
@end smallexample
|
||||||
@end ifnothtml
|
@end ifnothtml
|
||||||
@@ -9988,21 +9988,21 @@ sequence.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-s
|
|||||||
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
|
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
|
||||||
Shift/reduce conflict on token "word":
|
Shift/reduce conflict on token "word":
|
||||||
Example @red{•} @yellow{"word"}
|
Example @red{•} @yellow{"word"}
|
||||||
First derivation @yellow{sequence ::=[} @green{sequence ::=[} @red{•} @green{]} @yellow{"word" ]}
|
First derivation @yellow{sequence @arrow [} @green{sequence @arrow [} @red{•} @green{]} @yellow{"word" ]}
|
||||||
Example @red{•} @green{"word"}
|
Example @red{•} @green{"word"}
|
||||||
Second derivation @yellow{sequence ::=[} @green{maybeword ::=[} @red{•} @green{"word" ]} @yellow{]}
|
Second derivation @yellow{sequence @arrow [} @green{maybeword @arrow [} @red{•} @green{"word" ]} @yellow{]}
|
||||||
|
|
||||||
Reduce/reduce conflict on tokens $end, "word":
|
Reduce/reduce conflict on tokens $end, "word":
|
||||||
Example @red{•}
|
Example @red{•}
|
||||||
First derivation @yellow{sequence ::=[} @red{•} @yellow{]}
|
First derivation @yellow{sequence @arrow [} @red{•} @yellow{]}
|
||||||
Example @red{•}
|
Example @red{•}
|
||||||
Second derivation @yellow{sequence ::=[} @green{maybeword ::=[} @red{•} @green{]} @yellow{]}
|
Second derivation @yellow{sequence @arrow [} @green{maybeword @arrow [} @red{•} @green{]} @yellow{]}
|
||||||
|
|
||||||
Shift/reduce conflict on token "word":
|
Shift/reduce conflict on token "word":
|
||||||
Example @red{•} @yellow{"word"}
|
Example @red{•} @yellow{"word"}
|
||||||
First derivation @yellow{sequence ::=[} @green{sequence ::=[} @blue{maybeword ::=[} @red{•} @blue{]} @green{]} @yellow{"word" ]}
|
First derivation @yellow{sequence @arrow [} @green{sequence @arrow [} @blue{maybeword @arrow [} @red{•} @blue{]} @green{]} @yellow{"word" ]}
|
||||||
Example @red{•} @green{"word"}
|
Example @red{•} @green{"word"}
|
||||||
Second derivation @yellow{sequence ::=[} @green{maybeword ::=[} @red{•} @green{"word" ]} @yellow{]}
|
Second derivation @yellow{sequence @arrow [} @green{maybeword @arrow [} @red{•} @green{"word" ]} @yellow{]}
|
||||||
|
|
||||||
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
||||||
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
|
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
|
||||||
@@ -10034,9 +10034,9 @@ expr: %empty | expr ID ','
|
|||||||
@smallexample
|
@smallexample
|
||||||
Shift/reduce conflict on token ID:
|
Shift/reduce conflict on token ID:
|
||||||
First example @blue{expr} @red{•} @green{ID} @yellow{$end}
|
First example @blue{expr} @red{•} @green{ID} @yellow{$end}
|
||||||
First derivation @yellow{$accept ::=[} @green{s ::=[} @blue{a ::=[ expr} @red{•} @blue{]} @green{ID ]} @yellow{$end ]}
|
First derivation @yellow{$accept @arrow [} @green{s @arrow [} @blue{a @arrow [ expr} @red{•} @blue{]} @green{ID ]} @yellow{$end ]}
|
||||||
Second example @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
|
Second example @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
|
||||||
Second derivation @yellow{$accept ::=[} @green{s ::=[} @blue{a ::=[} @purple{expr ::=[ expr} @red{•} @purple{ID ',' ]} @blue{]} @green{ID ]} @yellow{$end ]}
|
Second derivation @yellow{$accept @arrow [} @green{s @arrow [} @blue{a @arrow [} @purple{expr @arrow [ expr} @red{•} @purple{ID ',' ]} @blue{]} @green{ID ]} @yellow{$end ]}
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
This conflict is caused by the parser not having enough information to know
|
This conflict is caused by the parser not having enough information to know
|
||||||
@@ -10433,9 +10433,9 @@ Shift/reduce conflict on token '/':
|
|||||||
1 exp: exp '+' exp •
|
1 exp: exp '+' exp •
|
||||||
4 exp: exp • '/' exp
|
4 exp: exp • '/' exp
|
||||||
Example @green{exp '+' exp} @red{•} @yellow{'/' exp}
|
Example @green{exp '+' exp} @red{•} @yellow{'/' exp}
|
||||||
First derivation @yellow{exp ::=[} @green{exp ::=[ exp '+' exp} @red{•} @green{]} @yellow{'/' exp ]}
|
First derivation @yellow{exp @arrow [} @green{exp @arrow [ exp '+' exp} @red{•} @green{]} @yellow{'/' exp ]}
|
||||||
Example @yellow{exp '+'} @green{exp} @red{•} @green{'/' exp}
|
Example @yellow{exp '+'} @green{exp} @red{•} @green{'/' exp}
|
||||||
Second derivation @yellow{exp ::=[ exp '+'} @green{exp ::=[ exp} @red{•} @green{'/' exp ]} @yellow{]}
|
Second derivation @yellow{exp @arrow [ exp '+'} @green{exp @arrow [ exp} @red{•} @green{'/' exp ]} @yellow{]}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
This shows two separate derivations in the grammar for the same @code{exp}:
|
This shows two separate derivations in the grammar for the same @code{exp}:
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ derivation_print_impl (const derivation *deriv, FILE *f,
|
|||||||
{
|
{
|
||||||
fputs (prefix, f);
|
fputs (prefix, f);
|
||||||
begin_use_class ("cex-step", f);
|
begin_use_class ("cex-step", f);
|
||||||
fprintf (f, "%s ::=[ ", sym->tag);
|
fprintf (f, "%s ", sym->tag);
|
||||||
|
print_arrow (f);
|
||||||
|
fprintf (f, " [ ");
|
||||||
end_use_class ("cex-step", f);
|
end_use_class ("cex-step", f);
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/gram.h
30
src/gram.h
@@ -217,23 +217,41 @@ typedef struct
|
|||||||
extern rule *rules;
|
extern rule *rules;
|
||||||
extern rule_number nrules;
|
extern rule_number nrules;
|
||||||
|
|
||||||
/* Fallback in case we can't print "•". */
|
/* Fallback in case we can't print "•" or "→". */
|
||||||
static inline long
|
static inline long
|
||||||
print_dot_fallback (unsigned int code _GL_UNUSED,
|
print_fallback (unsigned int code _GL_UNUSED,
|
||||||
const char *msg _GL_UNUSED,
|
const char *msg _GL_UNUSED,
|
||||||
void *callback_arg)
|
void *callback_arg)
|
||||||
{
|
{
|
||||||
FILE *out = (FILE *) callback_arg;
|
FILE *out = (FILE *) callback_arg;
|
||||||
putc ('.', out);
|
switch (code)
|
||||||
|
{
|
||||||
|
case 0x2022:
|
||||||
|
putc ('.', out);
|
||||||
|
break;
|
||||||
|
case 0x2192:
|
||||||
|
fputs ("->", out);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print "→", the symbol used to separate the lhs of a rule from its
|
||||||
|
rhs. */
|
||||||
|
static inline void
|
||||||
|
print_arrow (FILE *out)
|
||||||
|
{
|
||||||
|
unicode_to_mb (0x2192, fwrite_success_callback, print_fallback, out);
|
||||||
|
}
|
||||||
|
|
||||||
/* Print "•", the symbol used to represent a point in an item (aka, a
|
/* Print "•", the symbol used to represent a point in an item (aka, a
|
||||||
dotted rule). */
|
dotted rule). */
|
||||||
static inline void
|
static inline void
|
||||||
print_dot (FILE *out)
|
print_dot (FILE *out)
|
||||||
{
|
{
|
||||||
unicode_to_mb (0x2022, fwrite_success_callback, print_dot_fallback, out);
|
unicode_to_mb (0x2022, fwrite_success_callback, print_fallback, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the rule associated to this item. ITEM points inside RITEM. */
|
/* Get the rule associated to this item. ITEM points inside RITEM. */
|
||||||
|
|||||||
@@ -865,8 +865,8 @@ State 5
|
|||||||
1 exp: exp OP exp .
|
1 exp: exp OP exp .
|
||||||
1 exp: exp . OP exp
|
1 exp: exp . OP exp
|
||||||
Example exp OP exp . OP exp
|
Example exp OP exp . OP exp
|
||||||
First derivation exp ::=[ exp ::=[ exp OP exp . ] OP exp ]
|
First derivation exp -> [ exp -> [ exp OP exp . ] OP exp ]
|
||||||
Second derivation exp ::=[ exp OP exp ::=[ exp . OP exp ] ]
|
Second derivation exp -> [ exp OP exp -> [ exp . OP exp ] ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -1207,8 +1207,8 @@ State 1
|
|||||||
3 num: '0' .
|
3 num: '0' .
|
||||||
4 id: '0' .
|
4 id: '0' .
|
||||||
Example '0' .
|
Example '0' .
|
||||||
First derivation exp ::=[ num ::=[ '0' . ] ]
|
First derivation exp -> [ num -> [ '0' . ] ]
|
||||||
Second derivation exp ::=[ id ::=[ '0' . ] ]
|
Second derivation exp -> [ id -> [ '0' . ] ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1754,17 +1754,17 @@ State 4
|
|||||||
10 reported_conflicts: . %empty
|
10 reported_conflicts: . %empty
|
||||||
8 reported_conflicts: . 'a'
|
8 reported_conflicts: . 'a'
|
||||||
First example resolved_conflict . 'a'
|
First example resolved_conflict . 'a'
|
||||||
First derivation start ::=[ resolved_conflict reported_conflicts ::=[ . ] 'a' ]
|
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||||
Second example resolved_conflict . 'a' 'a'
|
Second example resolved_conflict . 'a' 'a'
|
||||||
Second derivation start ::=[ resolved_conflict reported_conflicts ::=[ . 'a' ] 'a' ]
|
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||||
|
|
||||||
Shift/reduce conflict on token 'a':
|
Shift/reduce conflict on token 'a':
|
||||||
10 reported_conflicts: . %empty
|
10 reported_conflicts: . %empty
|
||||||
9 reported_conflicts: . 'a'
|
9 reported_conflicts: . 'a'
|
||||||
First example resolved_conflict . 'a'
|
First example resolved_conflict . 'a'
|
||||||
First derivation start ::=[ resolved_conflict reported_conflicts ::=[ . ] 'a' ]
|
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||||
Second example resolved_conflict . 'a' 'a'
|
Second example resolved_conflict . 'a' 'a'
|
||||||
Second derivation start ::=[ resolved_conflict reported_conflicts ::=[ . 'a' ] 'a' ]
|
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1781,8 +1781,8 @@ State 5
|
|||||||
8 reported_conflicts: 'a' .
|
8 reported_conflicts: 'a' .
|
||||||
9 reported_conflicts: 'a' .
|
9 reported_conflicts: 'a' .
|
||||||
Example 'a' .
|
Example 'a' .
|
||||||
First derivation reported_conflicts ::=[ 'a' . ]
|
First derivation reported_conflicts -> [ 'a' . ]
|
||||||
Second derivation reported_conflicts ::=[ 'a' . ]
|
Second derivation reported_conflicts -> [ 'a' . ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1965,8 +1965,8 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
|||||||
12 empty_c2: . %empty
|
12 empty_c2: . %empty
|
||||||
13 empty_c3: . %empty
|
13 empty_c3: . %empty
|
||||||
Example . 'c'
|
Example . 'c'
|
||||||
First derivation start ::=[ empty_c2 ::=[ . ] 'c' ]
|
First derivation start -> [ empty_c2 -> [ . ] 'c' ]
|
||||||
Second derivation start ::=[ empty_c3 ::=[ . ] 'c' ]
|
Second derivation start -> [ empty_c3 -> [ . ] 'c' ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example A . B C
|
Example A . B C
|
||||||
First derivation s ::=[ a ::=[ A . ] x ::=[ B C ] ]
|
First derivation s -> [ a -> [ A . ] x -> [ B C ] ]
|
||||||
Second derivation s ::=[ y ::=[ A . B ] c ::=[ C ] ]
|
Second derivation s -> [ y -> [ A . B ] c -> [ C ] ]
|
||||||
|
|
||||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -76,13 +76,13 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example A . B C
|
Example A . B C
|
||||||
First derivation s ::=[ a ::=[ A . ] bc ::=[ B C ] ]
|
First derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
|
||||||
Second derivation s ::=[ ac ::=[ A ac ::=[ b ::=[ . B ] ] C ] ]
|
Second derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example A A . B B C C
|
Example A A . B B C C
|
||||||
First derivation s ::=[ a ::=[ A a ::=[ A . ] ] bc ::=[ B bc ::=[ B C ] C ] ]
|
First derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
|
||||||
Second derivation s ::=[ ac ::=[ A ac ::=[ A ac ::=[ b ::=[ . b ::=[ B B ] ] ] C ] C ] ]
|
Second derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
|
||||||
|
|
||||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -111,14 +111,14 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example A . B
|
Example A . B
|
||||||
First derivation s ::=[ ax ::=[ A x ::=[ . ] ] by ::=[ B y ::=[ ] ] ]
|
First derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
|
||||||
Second derivation s ::=[ A xby ::=[ . B ] ]
|
Second derivation s -> [ A xby -> [ . B ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
First example A X . B y $end
|
First example A X . B y $end
|
||||||
First derivation $accept ::=[ s ::=[ ax ::=[ A x ::=[ X x ::=[ . ] ] ] by ::=[ B y ] ] $end ]
|
First derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
|
||||||
Second example A X . B Y $end
|
Second example A X . B Y $end
|
||||||
Second derivation $accept ::=[ s ::=[ A xby ::=[ X xby ::=[ . B ] Y ] ] $end ]
|
Second derivation $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
|
||||||
|
|
||||||
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -147,9 +147,9 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token C:
|
Shift/reduce conflict on token C:
|
||||||
First example B . C D $end
|
First example B . C D $end
|
||||||
First derivation $accept ::=[ g ::=[ x ::=[ b ::=[ B . ] cd ::=[ C D ] ] ] $end ]
|
First derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
|
||||||
Second example B . C $end
|
Second example B . C $end
|
||||||
Second derivation $accept ::=[ g ::=[ x ::=[ bc ::=[ B . C ] ] ] $end ]
|
Second derivation $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
|
||||||
|
|
||||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -176,9 +176,9 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token A:
|
Shift/reduce conflict on token A:
|
||||||
First example A . A $end
|
First example A . A $end
|
||||||
First derivation $accept ::=[ s ::=[ s ::=[ t ::=[ x ::=[ A . ] ] ] t ::=[ x ::=[ A ] ] ] $end ]
|
First derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
|
||||||
Second example A . A B $end
|
Second example A . A B $end
|
||||||
Second derivation $accept ::=[ s ::=[ t ::=[ y ::=[ A . A B ] ] ] $end ]
|
Second derivation $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -209,14 +209,14 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token A:
|
Shift/reduce conflict on token A:
|
||||||
Example b . A X X Y
|
Example b . A X X Y
|
||||||
First derivation a ::=[ r ::=[ b . ] t ::=[ A x ::=[ X ] xy ::=[ X Y ] ] ]
|
First derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
|
||||||
Second derivation a ::=[ s ::=[ b . xx ::=[ A X X ] y ::=[ Y ] ] ]
|
Second derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token X:
|
Shift/reduce conflict on token X:
|
||||||
First example X . X xy
|
First example X . X xy
|
||||||
First derivation a ::=[ x ::=[ X . ] t ::=[ X xy ] ]
|
First derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
|
||||||
Second example A X . X
|
Second example A X . X
|
||||||
Second derivation a ::=[ t ::=[ A xx ::=[ X . X ] ] ]
|
Second derivation a -> [ t -> [ A xx -> [ X . X ] ] ]
|
||||||
|
|
||||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
@@ -242,8 +242,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||||
Reduce/reduce conflict on token $end:
|
Reduce/reduce conflict on token $end:
|
||||||
Example A b .
|
Example A b .
|
||||||
First derivation a ::=[ A b . ]
|
First derivation a -> [ A b . ]
|
||||||
Second derivation a ::=[ A b ::=[ b . ] ]
|
Second derivation a -> [ A b -> [ b . ] ]
|
||||||
|
|
||||||
input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -269,9 +269,9 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||||
Reduce/reduce conflict on tokens A, C:
|
Reduce/reduce conflict on tokens A, C:
|
||||||
First example D . A $end
|
First example D . A $end
|
||||||
First derivation $accept ::=[ s ::=[ a ::=[ D . ] A ] $end ]
|
First derivation $accept -> [ s -> [ a -> [ D . ] A ] $end ]
|
||||||
Second example B D . A $end
|
Second example B D . A $end
|
||||||
Second derivation $accept ::=[ s ::=[ B b ::=[ D . ] A ] $end ]
|
Second derivation $accept -> [ s -> [ B b -> [ D . ] A ] $end ]
|
||||||
|
|
||||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -298,9 +298,9 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
Shift/reduce conflict on token J:
|
Shift/reduce conflict on token J:
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example H i . J $end
|
First example H i . J $end
|
||||||
First derivation $accept ::=[ s ::=[ a ::=[ H i . ] J ] $end ]
|
First derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
|
||||||
Second example H i . J K $end
|
Second example H i . J K $end
|
||||||
Second derivation $accept ::=[ a ::=[ H i ::=[ i . J K ] ] $end ]
|
Second derivation $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
|
||||||
|
|
||||||
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -330,13 +330,13 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example N A . B C
|
Example N A . B C
|
||||||
First derivation s ::=[ n ::=[ N a ::=[ A . ] B ] C ]
|
First derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
|
||||||
Second derivation s ::=[ n ::=[ N b ::=[ A . B C ] ] ]
|
Second derivation s -> [ n -> [ N b -> [ A . B C ] ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token B:
|
Shift/reduce conflict on token B:
|
||||||
Example N N A . B D C
|
Example N N A . B D C
|
||||||
First derivation s ::=[ n ::=[ N n ::=[ N a ::=[ A . ] B ] D ] C ]
|
First derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
|
||||||
Second derivation s ::=[ n ::=[ N n ::=[ N b ::=[ A . B D ] ] C ] ]
|
Second derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
|
||||||
|
|
||||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -367,13 +367,13 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
||||||
Reduce/reduce conflict on tokens b, c:
|
Reduce/reduce conflict on tokens b, c:
|
||||||
Example B . b c
|
Example B . b c
|
||||||
First derivation S ::=[ B ::=[ A ::=[ B . ] b A ::=[ ] ] C ::=[ A ::=[ ] c A ::=[ ] ] ]
|
First derivation S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ]
|
||||||
Second derivation S ::=[ B C ::=[ A ::=[ B ::=[ A ::=[ . ] b A ::=[ ] ] ] c A ::=[ ] ] ]
|
Second derivation S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on tokens b, c:
|
Reduce/reduce conflict on tokens b, c:
|
||||||
Example C . c b
|
Example C . c b
|
||||||
First derivation S ::=[ C ::=[ A ::=[ C . ] c A ::=[ ] ] B ::=[ A ::=[ ] b A ::=[ ] ] ]
|
First derivation S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ]
|
||||||
Second derivation S ::=[ C B ::=[ A ::=[ C ::=[ A ::=[ . ] c A ::=[ ] ] ] b A ::=[ ] ] ]
|
Second derivation S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -400,52 +400,52 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
|
input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
|
||||||
Reduce/reduce conflict on token A:
|
Reduce/reduce conflict on token A:
|
||||||
First example . c A A $end
|
First example . c A A $end
|
||||||
First derivation $accept ::=[ a ::=[ b ::=[ . ] d ::=[ c A A ] ] $end ]
|
First derivation $accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] $end ]
|
||||||
Second example . c A A $end
|
Second example . c A A $end
|
||||||
Second derivation $accept ::=[ a ::=[ c ::=[ . ] d ::=[ c A A ] ] $end ]
|
Second derivation $accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] $end ]
|
||||||
|
|
||||||
Reduce/reduce conflict on token A:
|
Reduce/reduce conflict on token A:
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example b . c A A $end
|
First example b . c A A $end
|
||||||
First derivation $accept ::=[ a ::=[ b d ::=[ a ::=[ b ::=[ . ] d ::=[ c A A ] ] ] ] $end ]
|
First derivation $accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||||
Second example b . A $end
|
Second example b . A $end
|
||||||
Second derivation $accept ::=[ a ::=[ b d ::=[ c ::=[ . ] A ] ] $end ]
|
Second derivation $accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] $end ]
|
||||||
|
|
||||||
Reduce/reduce conflict on token A:
|
Reduce/reduce conflict on token A:
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example c . c A A $end
|
First example c . c A A $end
|
||||||
First derivation $accept ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ . ] d ::=[ c A A ] ] ] ] $end ]
|
First derivation $accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||||
Second example c . A $end
|
Second example c . A $end
|
||||||
Second derivation $accept ::=[ a ::=[ c d ::=[ c ::=[ . ] A ] ] $end ]
|
Second derivation $accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] $end ]
|
||||||
|
|
||||||
Shift/reduce conflict on token A:
|
Shift/reduce conflict on token A:
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example b c . c A A $end
|
First example b c . c A A $end
|
||||||
First derivation $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ . ] d ::=[ c A A ] ] ] ] ] ] $end ]
|
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||||
Second example b c . A
|
Second example b c . A
|
||||||
Second derivation a ::=[ b d ::=[ c . A ] ]
|
Second derivation a -> [ b d -> [ c . A ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on token A:
|
Reduce/reduce conflict on token A:
|
||||||
First example b c . c A A $end
|
First example b c . c A A $end
|
||||||
First derivation $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ . ] d ::=[ c A A ] ] ] ] ] ] $end ]
|
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||||
Second example b c . A $end
|
Second example b c . A $end
|
||||||
Second derivation $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ c ::=[ . ] A ] ] ] ] $end ]
|
Second derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||||
|
|
||||||
Shift/reduce conflict on token A:
|
Shift/reduce conflict on token A:
|
||||||
First example b c . A $end
|
First example b c . A $end
|
||||||
First derivation $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ c ::=[ . ] A ] ] ] ] $end ]
|
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||||
Second example b c . A
|
Second example b c . A
|
||||||
Second derivation a ::=[ b d ::=[ c . A ] ]
|
Second derivation a -> [ b d -> [ c . A ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on token $end:
|
Reduce/reduce conflict on token $end:
|
||||||
Example b d .
|
Example b d .
|
||||||
First derivation a ::=[ b d . ]
|
First derivation a -> [ b d . ]
|
||||||
Second derivation a ::=[ b d ::=[ d . ] ]
|
Second derivation a -> [ b d -> [ d . ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on token $end:
|
Reduce/reduce conflict on token $end:
|
||||||
Example c d .
|
Example c d .
|
||||||
First derivation a ::=[ c d . ]
|
First derivation a -> [ c d . ]
|
||||||
Second derivation a ::=[ c d ::=[ d . ] ]
|
Second derivation a -> [ c d -> [ d . ] ]
|
||||||
|
|
||||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
@@ -475,8 +475,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token J:
|
Shift/reduce conflict on token J:
|
||||||
Example H i J . J J
|
Example H i J . J J
|
||||||
First derivation s ::=[ a ::=[ H i ::=[ i J . ] J J ] ]
|
First derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
|
||||||
Second derivation s ::=[ a ::=[ H i J . J ] J ]
|
Second derivation s -> [ a -> [ H i J . J ] J ]
|
||||||
|
|
||||||
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -507,8 +507,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token D:
|
Shift/reduce conflict on token D:
|
||||||
Example A a . D
|
Example A a . D
|
||||||
First derivation s ::=[ A a a ::=[ b ::=[ c ::=[ . ] ] ] d ::=[ D ] ]
|
First derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
|
||||||
Second derivation s ::=[ A a d ::=[ . D ] ]
|
Second derivation s -> [ A a d -> [ . D ] ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -537,9 +537,9 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
|||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
Shift/reduce conflict on token D:
|
Shift/reduce conflict on token D:
|
||||||
First example A a . D E $end
|
First example A a . D E $end
|
||||||
First derivation $accept ::=[ s ::=[ A a a ::=[ b ::=[ c ::=[ . ] ] ] d ::=[ D ] E ] $end ]
|
First derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
|
||||||
Second example A a . D $end
|
Second example A a . D $end
|
||||||
Second derivation $accept ::=[ s ::=[ A a d ::=[ . D ] ] $end ]
|
Second derivation $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|||||||
@@ -376,10 +376,12 @@ exp:^M
|
|||||||
]],
|
]],
|
||||||
[0],
|
[0],
|
||||||
[[input.y:11.9-11: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
|
[[input.y:11.9-11: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
|
||||||
11 | %token
|
11 | %token
|
||||||
|
<warning>FOO</warning>
|
||||||
| <warning>^~~</warning>
|
| <warning>^~~</warning>
|
||||||
input.y:10.9-11: <note>note:</note> previous declaration
|
input.y:10.9-11: <note>note:</note> previous declaration
|
||||||
input.y:10.9-11: <note>note:</note> previous declaration
|
10 | %token
|
||||||
|
<note>FOO</note>
|
||||||
| <note>^~~</note>
|
| <note>^~~</note>
|
||||||
input.y:13.5: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
input.y:13.5: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
13 | exp:
|
13 | exp:
|
||||||
@@ -535,27 +537,27 @@ exp
|
|||||||
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
|
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
Example <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
Example <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||||
Shift/reduce conflict on token "+":
|
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||||
Example <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
Example <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||||
First derivation <cex-0><cex-step>exp ::=[ </cex-step><cex-1><cex-step>exp ::=[ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
Second derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||||
|
|
||||||
Shift/reduce conflict on token "else":
|
Shift/reduce conflict on token "else":
|
||||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||||
Shift/reduce conflict on token "else":
|
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||||
First derivation <cex-0><cex-step>exp ::=[ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp ::=[ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
Second derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||||
Shift/reduce conflict on token "+":
|
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||||
First derivation <cex-0><cex-step>exp ::=[ </cex-step><cex-1><cex-step>exp ::=[ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
Second derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||||
Shift/reduce conflict on token "+":
|
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||||
First derivation <cex-0><cex-step>exp ::=[ </cex-step><cex-1><cex-step>exp ::=[ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
Second derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|||||||
@@ -1539,33 +1539,33 @@ AT_CHECK([LC_ALL="$locale" bison -fno-caret -o input.cc -rall -Wcex --graph=inpu
|
|||||||
input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
|
input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
|
||||||
Shift/reduce conflict on token "⊕":
|
Shift/reduce conflict on token "⊕":
|
||||||
Example exp "+" exp • "⊕" exp
|
Example exp "+" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||||
Example exp "+" exp •
|
Example exp "+" exp •
|
||||||
First derivation exp ::=[ exp "+" exp • ]
|
First derivation exp → [ exp "+" exp • ]
|
||||||
Second derivation exp ::=[ exp "+" exp • ]
|
Second derivation exp → [ exp "+" exp • ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "⊕":
|
Shift/reduce conflict on token "⊕":
|
||||||
Example exp "+" exp • "⊕" exp
|
Example exp "+" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "⊕":
|
Shift/reduce conflict on token "⊕":
|
||||||
Example exp "⊕" exp • "⊕" exp
|
Example exp "⊕" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
Example exp "⊕" exp • "+" exp
|
Example exp "⊕" exp • "+" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "+" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "+" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
Example exp "⊕" exp • "+" exp
|
Example exp "⊕" exp • "+" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "+" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "+" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||||
|
|
||||||
input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]])
|
]])
|
||||||
@@ -1714,22 +1714,22 @@ State 7
|
|||||||
2 exp: exp "+" exp •
|
2 exp: exp "+" exp •
|
||||||
1 exp: exp • "⊕" exp
|
1 exp: exp • "⊕" exp
|
||||||
Example exp "+" exp • "⊕" exp
|
Example exp "+" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||||
2 exp: exp "+" exp •
|
2 exp: exp "+" exp •
|
||||||
3 exp: exp "+" exp •
|
3 exp: exp "+" exp •
|
||||||
Example exp "+" exp •
|
Example exp "+" exp •
|
||||||
First derivation exp ::=[ exp "+" exp • ]
|
First derivation exp → [ exp "+" exp • ]
|
||||||
Second derivation exp ::=[ exp "+" exp • ]
|
Second derivation exp → [ exp "+" exp • ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "⊕":
|
Shift/reduce conflict on token "⊕":
|
||||||
3 exp: exp "+" exp •
|
3 exp: exp "+" exp •
|
||||||
1 exp: exp • "⊕" exp
|
1 exp: exp • "⊕" exp
|
||||||
Example exp "+" exp • "⊕" exp
|
Example exp "+" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1751,22 +1751,22 @@ State 8
|
|||||||
1 exp: exp "⊕" exp •
|
1 exp: exp "⊕" exp •
|
||||||
1 exp: exp • "⊕" exp
|
1 exp: exp • "⊕" exp
|
||||||
Example exp "⊕" exp • "⊕" exp
|
Example exp "⊕" exp • "⊕" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "⊕" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "⊕" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
1 exp: exp "⊕" exp •
|
1 exp: exp "⊕" exp •
|
||||||
2 exp: exp • "+" exp
|
2 exp: exp • "+" exp
|
||||||
Example exp "⊕" exp • "+" exp
|
Example exp "⊕" exp • "+" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "+" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "+" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||||
|
|
||||||
Shift/reduce conflict on token "+":
|
Shift/reduce conflict on token "+":
|
||||||
1 exp: exp "⊕" exp •
|
1 exp: exp "⊕" exp •
|
||||||
3 exp: exp • "+" exp
|
3 exp: exp • "+" exp
|
||||||
Example exp "⊕" exp • "+" exp
|
Example exp "⊕" exp • "+" exp
|
||||||
First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "+" exp ]
|
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||||
Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "+" exp ] ]
|
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user