[Top][All Lists]

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

Re: YYEOF shouldn't be defined with bison -y

From: Akim Demaille
Subject: Re: YYEOF shouldn't be defined with bison -y
Date: Thu, 13 Sep 2018 08:50:10 +0200


> Le 18 août 2018 à 15:46, Dimitrios Apostolou <address@hidden> a écrit :
> On Sat, 18 Aug 2018 06:39:36 +0200,
> Akim Demaille wrote:
>> There’s something which is not fully clear here: unless _you_ used YYEOF
>> somewhere in your code, there’s no reason for the parser not to be
>> compilable with byacc.
> Yes, YYEOF was used in the project that I maintained, but I was not the one
> that introduced it. After years of patches from various people, it was
> incidentally discovered that the parser fails to compile with byacc, because
> at some point usage of YYEOF was introduced, and it went undetected, despite
> having always generated the parser using "bison -y".
>> So I expect that you did use YYEOF.  In which case, the question is rather:
>> where was it used, to what purpose, and how would you have expected to
>> write it independently of YYEOF?
> I'm not sure of the details at the moment, but YYEOF usage got removed
> eventually. What I did myself to ensure that this does not happen again, I
> changed the Travis build environment to uninstall bison and install byacc. So
> now every commit is verified that is yacc-compatible before being
> merged. Still I believe that « bison -y" ought to catch such errors.

I’m still trying to figure out how to handle this, and I
see nothing satisfying.  YYEOF is defined to 0, and I certainly
do not want to replace symbolic values by actual numbers.  And
Bison itself has to check in many places whether a token is YYEOF
or not.  Using 0 instead of YYEOF is wrong.  And bison will not
start looking at the user’s action to see if she’s using YYEOF
(what if she took care of defining it if it is not).  Since it’s
a macro, it’s straightforward for the user to provide a definition
if it is undefined.

Besides, I see that byacc defines YYEOF, since April 2014, and
does not provide an option -y that would allow to control this.

So I don’t see any approach that would improve the global situation,
sorry :(


reply via email to

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