bug-bison
[Top][All Lists]
Advanced

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

Re: why are locations dictated by bison?


From: Hans Aberg
Subject: Re: why are locations dictated by bison?
Date: Fri, 18 Jan 2002 13:00:01 +0100

At 12:43 -0500 2002/01/17, Bruce Lilly wrote:
> Given that simplicity, why
>introduce incompatibility and maintenance headaches?

I just want to point out the possibility; not determine whether it's worth it.

In traditional C, \0 is used as a string terminator, so then its is no
point in giving it special consideration.

But C++ strings do not have that restriction, and Unicode is coming along
as well. So it might be prudent to treat \0 as a full character in all
circumstances: Not doing so may cause people to overlook proper treatment
on this silly little detail.

>It's not a mere case of bison vs. yacc. Any combination of
>{bison, yacc, byacc, etc.} with {flex, lex, etc.} might be
>used.

I guess that first, just as Bison has a Yacc compatibility mode, Flex needs
a Lex compatibility mode.

But then idea that now springs up is that the Flex mode is tuned together
to Bison, and Bison only. This does not mean that Flex cannot be used with
the other ones, only that the fine tuning is with Bison.

The idea with using the YYEOF macro would be prudent rather regardless of
its value, as one should normally use macros, instead of values. One could
introduce it now, and pave the way for any eventual change in the future.

So
  #ifndef YYEOF
  #define YYEOF
  #endif
  ...
  return YYEOF;
would not cause any incompatibilities, but would admit those that want to
change it to do so, plus by using YYEOF explicitly, it would communicate to
the human reader that this is an end of parser condition.

  Hans Aberg





reply via email to

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