bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] more on prologue alternatives


From: Joel E. Denny
Subject: Re: [PATCH] more on prologue alternatives
Date: Wed, 4 Oct 2006 03:09:12 -0400 (EDT)

On Tue, 3 Oct 2006, Bonzini Paolo wrote:

> Well, you could say that you need only two instead of three: in my case it
> is "outside the parser class" (e.g. for imports) and "inside" (for
> methods used in the actions).  But they don't really map to header/code,
> so I'm using %{...%} respectively before/after %%.

I agree that header vs. code is not the best terminology for this Java 
issue.

> > 3. Change %start-header{...} to %type-code{...}.  For C/C++ users, this is 
> > the right place to put any code that is required by YYSTYPE or YYLTYPE.  
> > You probably don't need it in Java, but you could use it if you'd like to 
> > organize your output.
> 
> I don't like the %type-code name (constructive criticism in a couple
> of paragraphs!).

How about %dependencies{...}?  In Java, it could be used for your imports.  
%code{...} could be used for your parser methods.  %header{...} would have 
no meaning and could be disallowed for Java, right?

> > 4. Remove %before-header entirely.  We're not sure it's actually 
> > necessary.
> 
> I would put #include directives for the parser
> there in C (e.g. <stdlib.h>), since %before-header IIRC is just good
> old %{...%}.  But in the end putting them in %after-header wouldn't be
> a problem, right?

That's my thinking.

> A renaming proposal working for me would be %after-header -> %code, and
> %before-header -> %prolog, and likewise %header-code and %header-prolog.

I think Akim would like to get rid of %before-header for C/C++, and I can 
live without it as well.

To reduce confusion, I'd like not to use the word prologue since it 
already refers to %{...%} and all its baggage.

> This, plus letting these appear in the grammar section, would be just
> perfect.

Letting them appear in the grammar section should already be possible in 
CVS Bison.  Whether they appear there or in the definitions section does 
not affect what they do.




reply via email to

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