[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: fix %start after first rule
From: |
Akim Demaille |
Subject: |
Re: FYI: fix %start after first rule |
Date: |
Thu, 14 Sep 2006 09:59:43 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
>>> "Joel" == Joel E Denny <address@hidden> writes:
> 3. In general I think it's easier to evolve Bison when the syntax
> analysis of the user grammar file is a separate phase from the
> semantic analysis as much as possible. That is, Bison shouldn't
> try to understand user declarations until it has read them all.
I totally subscribe to this view from the implementation point of
view. Still, I am in favor of having a semantic pass doing a regular
left to right analysis, where entities are expected to be defined (or
declared) before being used.
> In many cases, I agree that we should encourage a specific coding
> style. Requiring %start to be in the definitions section maybe
> always makes sense. I won't argue if we change parse-gram.y
> accordingly (but I hope we won't revert the changes I made). We
> can always change it back later if we discover a need.
I'm in between: I don't see why this should be only in the prologue,
but it should not be after what it refers to.
> In other cases, I think we should trust the user to figure out what is the
> right style for his grammar. For example, I *sometimes* like to be able
> to declare `%type <my_field> my_nt' next to the one set of rules for which
> my_nt is the LHS.
That's the reason why I relaxed the constraint on the prologue
directives :) But that's different, it is a matter of *modularity*,
not of commutativity.