On Thu, 22 Jun 2006, Paul Eggert wrote:

> "Joel E. Denny" <[EMAIL PROTECTED]> writes:
> 
> > Just to make sure I'm being clear: before the first %union, a prologue 
> > block would have the same function as %before-header does anywhere.  
> > After that %union, a prologue block would have the same function as 
> > %after-header does anywhere.
> 
> I'm a bit lost.  But I guess you're saying we'd have the following
> types of code blocks (other than rule actions)
> 
> %union
> %{
> %before-header
> %after-header
> %before-definitions
> %after-definitions
> %% (after rules)
> 
> and, except for %%, you can jumble things up any which way, but the
> output order will always be -- what?

To keep things less confusing, the user should be advised to do things 
either the Yacc way or the new way with order-independent declarations.  

If he does it the Yacc way, the following would be the layout of the code 
file.  Everything between the lines would be the layout of the header 
file:

  pre-prologue
  ----------------------------
  Bison-generated union, YYLTYPE, enum, classes
  ----------------------------
  post-prologue

If he does it new way, the following would be the layout of the code file.  
Everything between the lines would be the layout of the header file:

  before-header
  ----------------------------
  before-definitions
  Bison-generated union, YYLTYPE, enum, classes
  after-definitions
  ----------------------------
  after-header

If the user insists on combining the approaches, that's where my confusing 
quote at the top of this message comes in.

> Sorry, but this is all still sounding pretty complicated.  Can't we
> simplify it somehow?

Does the above explanation make it any better?  I think providing a full 
self-consistent alternative to the Yacc prologue declarations is simpler 
and more flexible than my previous hybrid (which had Yacc prologues 
combined with %before-definitions and %after-definitions).

Joel


Reply via email to