bison-patches
[Top][All Lists]
Advanced

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

Re: RFC: %param


From: Joel E. Denny
Subject: Re: RFC: %param
Date: Mon, 7 Sep 2009 14:26:03 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Mon, 7 Sep 2009, Akim Demaille wrote:

> I was tired to read
> 
> > %parse-param {::parser::ParserImpl& up}
> > %lex-param {::parser::ParserImpl& up}
> > %parse-param {yyFlexLexer& scanner}
> > %lex-param {yyFlexLexer& scanner}
> 
> in my code, I wanted
> 
> > %param {::parser::ParserImpl& up}{yyFlexLexer& scanner};

I like it.

> I pushed this feature in candidates/%param, but there are several issues:
> 
> - I had not noticed, but when I started upgrading the documentation, I
> discovered that in lalr1.java, the %lex-params are added to the signature of
> yyparse, which in my case would have allowed to use only %lex-params.  It
> makes sense,

I've been too distant from the Java skeletons for too long to help much 
here.

> but I am uncomfortable with the coexistence of several
> conventions within Bison.

I definitely agree with that philosophy.

> - I like to keep related things close to each other.  But sometimes it can
> clutter the code.  Here, as often in my grammars, I have put together
> everything related to %(lex-|parse-)?param management, but it disrupts the
> reading of the grammar.  What do people prefer?  Currently, it reads:

I agree that the grammar does tend to become obfuscated when there are 
large passages of other code mixed with it, so maybe the grammar should be 
kept separate.  But I like the way you've kept related blocks of C 
together with their union fields.  Whether those should come before or 
after the grammar is not clear to me.  You could think of them as 
belonging to the tokens, which are traditionally declared before the 
grammar even in language standards documents.  On the other hand, in a 
fully top-down grammar, it seems logical to declare tokens afterward.  
Sorry, I'm not being much help.




reply via email to

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