[Top][All Lists]

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

Re: prologue alternatives

From: Joel E. Denny
Subject: Re: prologue alternatives
Date: Mon, 18 Sep 2006 18:57:42 -0400 (EDT)

On Mon, 18 Sep 2006, Paul Eggert wrote:

> > In this case, the user might wish not to use %defines.  However, some of 
> > the skeletons require %defines.  In order to get the declaration order 
> > right in that required header file, it might be necessary to have:
> >
> >   %defines "my_parser.h" {
> >     $var{stype-code}
> >     $var{YYSTYPE}
> >   }
> >
> > to tell Bison that "my_parser.h" is the header file it requires.
> Sorry, I don't quite follow.  Would the above be syntactic sugar for this?
>   %{ #include "my_parser.h" %}
>   %file "my_parser.h" {
>     $var{stype-code}
>     $var{YYSTYPE}
>   }
> If not, then what is the difference?

For some skeletons (C++ and GLR as I recall), Bison would need to know 
that "my_parser.h" is the main parser header file so that it won't 
complain that %defines is required.  That is, `%defines "my_parser.h" 
{...}' would be the same as `%file "my_parser.h" {...}' except it tells 
Bison that "my_parser.h" is this special file.

> It sounds like you're thinking
> %defines should put something extra into my_parser.h


>, but if that's an
> issue can't we give that extra thing a name and let it be another
> $var{tokens} or something like that?

I think so.

reply via email to

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