help-bison
[Top][All Lists]
Advanced

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

Re: help-bison Digest, Vol 30, Issue 15


From: Joel E. Denny
Subject: Re: help-bison Digest, Vol 30, Issue 15
Date: Mon, 24 Apr 2006 01:31:47 -0400 (EDT)

On Sun, 23 Apr 2006, Steve Murphy wrote:

> On Sun, 2006-04-23 at 10:02 -0600, Joel Denny wrote:
> 
> > 
> > There are two possibilities here:
> > 
> > 1. The start symbol does not appear on the RHS of any other production.  
> > In this case, you can't access its semantic value later, so why set it at 
> > all?
> 
> True. Only reasons I can think of, are the usual reasons for doing
> unneccessary things: convention, habit, consistency, you get a warning
> if don't,  etc.

If its value is not used, there's no point in declaring a type or 
%destructor for the start symbol.  If you don't add these declarations, 
you shouldn't get a warning about it being unset.  Declaring unused types 
and destructors and assigning unused values seems misleading to me.

> If the start symbol is going to be passed to yydestruct() come rain or
> shine (if so specified in a %destructor), it might be meaningful to know
> which it is... in other words, I haven't tried to understand the
> algorithm, but firstly, can an error result in the start symbol being
> tossed?

Yes, after a valid sentence, there might be extra tokens.

> If so, is there any way for yydestruct to determine whether the
> start symbol is being tossed for Cleanup reasons, or for Error reasons?
> (I think there could be situations where it might matter...).

I know of no reliable way.  Do you have an example where it's necessary to 
do this?

Joel




reply via email to

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