[Top][All Lists]

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

Re: Section 3.1.2 has what appears to be a bug

From: Kaz Kylheku
Subject: Re: Section 3.1.2 has what appears to be a bug
Date: Sun, 19 Jun 2022 09:06:40 -0700
User-agent: Roundcube Webmail/1.4.13

On 2022-06-17 10:26, slipbits wrote:
> 3.1.2 Prologue Alternatives, pg. 50
>    “and the new YYLTYPE definition before the Bison-generated YYSTYPE
>    and YYLTYPE definitions in both the parser implementation file and
>    the parser header file”.
>    This position causes, in this case, YYLTYPE to be doubly defined in the 
> same scope.
[ elided ]
> Is this a bug?

There are ways in which both the header file and the parser source file
can independently provide a definition such that they don't clash:

  /* paste freely wherever you want, however many times you want */
  #ifndef FOO_DEFINED
  struct foo { int x; };
  #define FOO_DEFINED

The text refers to an example, and in that example this appears:

  typedef struct YYLTYPE
  { ...

in all likelihood, the Bison-generated skeleton code is checking for
the presence of the preprocessor symbol

You should try the example; if that doesn't work, then there is a bug.

I don't use YYLTYPE, but for YYSTYPE, Bison clearly generates
code like:

  if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  typedef union YYSTYPE

Not sure about Java and other supported languages that don't have

reply via email to

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