bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] examples: add new build scenario test case


From: Kaz Kylheku
Subject: Re: [PATCH] examples: add new build scenario test case
Date: Sun, 20 Sep 2020 13:01:08 -0700
User-agent: Roundcube Webmail/0.9.2

On 2020-09-19 02:44, Akim Demaille wrote:
Hi Kaz,

I guess this example can be used as a basis to discuss of "one
feature at a time", as I mentioned in the other thread.

I fully disagree with what you are doing here.  You completely
discard features that have been designed to address your exact
needs: specifying what goes into the headers.  That's the point
of "%code requires" and "provides", introduced in Bison 2.4 (that's
twelve years ago!).  These features are so obviously needed that
even Byacc features them now.

Byacc added %code in November 2019; it has not even been a year!

I will definitely look into using %code provides, maybe in a three
to five year time frame.

Anyway, I cannot fix my old commits to use that approach.

I can try to rework the test case so that it doesn't do the sed
hack for removing yyparse from y.tab.h, yet still covers everything
that is salient, in order to keep it working.

The following commit shows how this example should look like.
I've made it available as https://github.com/akimd/bison/tree/kaz
if you want an easier access.

Is there no existing example with a test case covering this?

If that's the situation, your version should definitely be added.

But that doesn't negate the validity of the original.

By analogy with C, just because we have

  switch (var) {
  case X: x(); break;
  case Y: y(); break;
  default: z(); break
  }

and we can find it documented in the 1978 K&R1 book doesn't mean
that the following is not valid as a test case:

  if (var == X) { x(); }
  else if (var == Y) { y(); }
  else { z(); }

Though the best practice for switching on constant values of
a variable is a switch, the above has to work also.

If we fix such code in a program to a better style, we still
need the old commits to build.




reply via email to

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