bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] cex: prefer → to ::=


From: Akim Demaille
Subject: Re: [PATCH 3/3] cex: prefer → to ::=
Date: Sun, 12 Jul 2020 08:19:28 +0200


> Le 11 juil. 2020 à 18:53, Akim Demaille <akim.demaille@gmail.com> a écrit :
> 
> 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.

As a matter of fact, @arrow works in PDF, but not with makeinfo.  So
I install this.


commit 121dd985087a13537a3464932b797f5923bfd61e
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sun Jul 12 08:15:44 2020 +0200

    doc: makeinfo wants @arrow{}, not @arrow
    
    * doc/bison.texi: here.

diff --git a/doc/bison.texi b/doc/bison.texi
index 59b71a7c..90adab69 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -9937,9 +9937,9 @@ output is actually in color)}:
 Shift/reduce conflict on token "else":
 @group
   Example            @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} 
@red{•} @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 ]}
+  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}
-  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{]}
+  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 example
 @end ifhtml
@@ -9950,11 +9950,11 @@ Shift/reduce conflict on token "else":
   Example
     @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} 
@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 ]}
+    @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}
   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{]}
+    @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 smallexample
 @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}]
 Shift/reduce conflict on token "word":
   Example              @red{•} @yellow{"word"}
-  First derivation     @yellow{sequence @arrow [} @green{sequence @arrow [} 
@red{•} @green{]} @yellow{"word" ]}
+  First derivation     @yellow{sequence @arrow{} [} @green{sequence @arrow{} 
[} @red{•} @green{]} @yellow{"word" ]}
   Example              @red{•} @green{"word"}
-  Second derivation    @yellow{sequence @arrow [} @green{maybeword @arrow [} 
@red{•} @green{"word" ]} @yellow{]}
+  Second derivation    @yellow{sequence @arrow{} [} @green{maybeword @arrow{} 
[} @red{•} @green{"word" ]} @yellow{]}
 
 Reduce/reduce conflict on tokens $end, "word":
   Example              @red{•}
-  First derivation     @yellow{sequence @arrow [} @red{•} @yellow{]}
+  First derivation     @yellow{sequence @arrow{} [} @red{•} @yellow{]}
   Example              @red{•}
-  Second derivation    @yellow{sequence @arrow [} @green{maybeword @arrow [} 
@red{•} @green{]} @yellow{]}
+  Second derivation    @yellow{sequence @arrow{} [} @green{maybeword @arrow{} 
[} @red{•} @green{]} @yellow{]}
 
 Shift/reduce conflict on token "word":
   Example              @red{•} @yellow{"word"}
-  First derivation     @yellow{sequence @arrow [} @green{sequence @arrow [} 
@blue{maybeword @arrow [} @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"}
-  Second derivation    @yellow{sequence @arrow [} @green{maybeword @arrow [} 
@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}]
     8 |   @dwarning{%empty    @{ printf ("empty maybeword\n"); @}}
@@ -10034,9 +10034,9 @@ expr: %empty | expr ID ','
 @smallexample
 Shift/reduce conflict on token ID:
   First example        @blue{expr} @red{•} @green{ID} @yellow{$end}
-  First derivation     @yellow{$accept @arrow [} @green{s @arrow [} @blue{a 
@arrow [ 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 derivation    @yellow{$accept @arrow [} @green{s @arrow [} @blue{a 
@arrow [} @purple{expr @arrow [ 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
 
 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 •
     4 exp: exp • '/' exp
   Example              @green{exp '+' exp} @red{•} @yellow{'/' exp}
-  First derivation     @yellow{exp @arrow [} @green{exp @arrow [ 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}
-  Second derivation    @yellow{exp @arrow [ exp '+'} @green{exp @arrow [ exp} 
@red{•} @green{'/' exp ]} @yellow{]}
+  Second derivation    @yellow{exp @arrow{} [ exp '+'} @green{exp @arrow{} [ 
exp} @red{•} @green{'/' exp ]} @yellow{]}
 @end example
 
 This shows two separate derivations in the grammar for the same @code{exp}:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]