help-bison
[Top][All Lists]
Advanced

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

Re: inserting into tab.h, after %union


From: Joel E. Denny
Subject: Re: inserting into tab.h, after %union
Date: Wed, 6 Dec 2006 23:25:55 -0500 (EST)

On Wed, 6 Dec 2006, Hans Aberg wrote:

> The problem is not that they are complicated, as they are rather
> straightforward, but eneded up with descriptions hard to understand what they
> do.

I have some ideas on how to improve it.  I'll work on that later.

> When I tweaked Bison, I used names (internally in the tweak) like preamble for
> code (in the source file) before the union, and something else for code after
> it. This is still low level names, without being too language specific. There,
> one be reasonably sure, it is language independent.

Actually, names with words like "before" and "after" are not completely 
language-independent.  Imagine Java where declaration order is 
unimportant, and thus there's no need for this distinction.

> Now, I think that the Bison setup isn't even
> designed for handling redefinition of YYSTYPE. So I do not immediately see
> exactly what is needed, and how the current Bison commands will support that.

 -- Directive: %requires {CODE}
     This is the right place to write dependency code for externally
     exposed definitions required by Bison.  Such exposed definitions
     are those usually appearing in the parser header file.  Thus, this
     is the right place to define types referenced in `%union {CODE}'
     directives, and it is the right place to override Bison's default
     `YYSTYPE' and `YYLTYPE' definitions.

In 2.3a, %requires was called %start-header.  Let me know if it doesn't 
work for you.




reply via email to

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