bison-patches
[Top][All Lists]
Advanced

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

Re: $$ = $1


From: Paul Eggert
Subject: Re: $$ = $1
Date: Thu, 1 Aug 2002 07:41:29 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 01 Aug 2002 12:35:15 +0200

> | It seems a bit Draconian to outlaw "empty:;", though.
> 
> It doesn't to me: after all, not using %type is like declaring
> everybody as <int>.

I guess it's OK, if the workaround is simply to use "empty:{};".
(It's still a bit ugly though.)

> | However, it would be helpful for Bison to reject "empty:;" if some
> | other rule uses the value of "empty".  More generally, Bison should
> | reject a grammar that uses the semantic value of a nonterminal that is
> | known to be unsafe.  A nonterminal is "known to be unsafe" if it has
> | an actionless right-hand side that either is empty or starts with an
> | nonterminal that is known to be unsafe.  I don't know if it would be
> | easy to implement a test like that, but if done correctly I think it
> | would remove the need for the current "empty rule for typed
> | nonterminal, and no action" test, as it would apply equally well to
> | typed and untyped grammars.  (Easy for me to say, huh?  I haven't
> | looked at the code.  :-)
> 
> My main concern is that it seems to be quite some work for a marginal
> case: I suppose there are really few %type-less parser out there.

%type-less parsers are mostly academic exercises, but shouldn't Bison
be friendly to students too?

However, since I don't have time to do it now, perhaps we can just put
this on the TODO list.


> And again, I prefer something more homogeneous: %type-less is
> %type<int>-full.

That's fine.  The more-complicated rule (in the above-quoted long
paragraph) has that property too.  The main advantage of the
more-complicated rule is that it allows "empty:;" in some cases where
the simpler rule rejects it.



reply via email to

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