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

Kaz Kylheku <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.