[Top][All Lists]

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

Re: usage $0 (was warning: unused value: $3)

From: henrik . sorensen
Subject: Re: usage $0 (was warning: unused value: $3)
Date: Thu, 26 Oct 2006 16:49:56 +0200
User-agent: KMail/1.9.1

On Wednesday 25 October 2006 23:35, Hans Aberg wrote:
> >> be guaranteed, in view of that Bison is switching to other types of
> >> containers than an underlying array.
> > but should the container still support the $0 notation ?
that did not come out right, should have read
...but surely the new containers will have to support the $0 notation ?

> My memory is hazy, so you will have to wait for the developers with  
> the full story. 
ok, I will wait.
btw, is help-bison the right list for this kind of discussions ?

> I think this feature may never have been official,   
> but only something people used, in view of that there was an array  
> used for parser stack. But when switching to C++ containers, such as  
> std::deque, it may not hold up anymore.

I was just checking my library and the 198x DragonBook describes inherited 
attributes, the 1992 Lex&Yacc book have a dedicated section describing how to 
use $0, and info pages have references to $0, so I do not understand how you 
can possibly argue that this an 'unofficial' feature. 
Would you mind expand on your point of view?

IMO, $0 is pretty much a trademark feature of LALR(1) parsers.

> > it is a shame though, because the checking, setting of the parsed  
> > values are
> > now tied together in just the parser rule.
> I think this is a problem of the bottom up parsing methods, like the  
> LALR(1) that Bison uses. Formally, the parser, only knows the  
> semantic values, as they are constructed from the leaves and up of  
> the parse tree.

but that is exactly why it is very useful to have the $0 as a way to inherit 
the necessary context to the leaves.


reply via email to

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