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: Paolo Bonzini
Subject: Re: [PATCH] more on prologue alternatives
Date: Tue, 03 Oct 2006 20:07:33 +0200
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)


But the dependence on the %union position is one of the key problems I was trying to eliminate. I don't have time to examine your patch right now, but, if I understand the explanation above, the only way to do the equivalent of %end-header or %after-header is to have a %union. What if the user doesn't have a %union?
You place your %{...%} or %header { ... } block *after the %%*, in the grammar section. Java will not use %union in fact, but it needs to have "%{...%}" after the %% to declare parser methods.
Also, I'd like to see this kind of grammar organization work:

  %start-header { #include "type1.h" }
  %union { type1 field1; }
  %destructor { type1_destroy ($$); } <type1>

  %start-header { #include "type2.h" }
  %union { type2 field2; }
  %destructor { type2_destroy ($$); } <type2>

This should be allowed in the definitions or rules section. If you change %start-header to %header under your proposal, it won't work.
Yeah, I understand. But I wonder if it warrants the needed complexity. In C, I put all my includes at the beginning of the file. It gives me a quick way to see the interfaces I need in the file; I don't see the need to scatter #include's here and there in a Bison source code?

I think it is a misfeature that %{...%} works differently when you're using multiple-unions. But since we have to live with it, we'd better make it coherent.
Thanks for your interest in this problem. Maybe you'd like to catch up with our latest discussion starting here:

  http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00048.html
Already read, and was lost around the end of the thread. :-)

Paolo




reply via email to

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