help-bison
[Top][All Lists]
Advanced

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

Re: interesting push parser use case


From: Laurence Finston
Subject: Re: interesting push parser use case
Date: Thu, 21 Feb 2008 10:09:37 +0100 (CET)

On Wed, 20 Feb 2008, Bob Rossi wrote:

> Hi Laruence,
> 
> Sorry for the extremely long delay. 

No need to apologize.

> I'm trying out your suggestion now.
> Whenver I put a struct in the parse param like so,
>   %parse-param { struct gdbmi_pdata *gdbmi_pdata }
> I get a compiler warning, 
> ../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.h:127: warning: ???struct
> gdbmi_pdata??? declared inside parameter list

I don't have a `%parse-param' declaration in my grammar.  I just pass 
the argument to `yyparse' by means of a `void*' and cast it to the 
correct type, where needed.  It isn't always needed.  

I don't know when the `%parse-param' feature was introduced.  It might
not have existed when I started my grammar.  Otherwise, I probably
would have used it.

> Do you know how to avoid that? It seems like the header file generated
> has the struct in the parameter list but the definition is not in global
> scope.

I would expect that it would work to declare it in a header file that's 
included by your Bison input file or in the first section ("prologue") 
of your grammar, where the header files are included.  However, I
haven't tried this and I don't know how or when Bison processes the
`%parse-param' declaration.  However, it's really not much of a
nuisance to cast it.  I just do it automatically without thinking
about it.

Laurence

reply via email to

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