help-bison
[Top][All Lists]
Advanced

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

Re: Enum for token '0', EOF


From: Joel E. Denny
Subject: Re: Enum for token '0', EOF
Date: Sun, 9 Jul 2006 11:17:34 -0400 (EDT)

On Sun, 9 Jul 2006, Akim Demaille wrote:

> A friend of mine was using END in his grammars in a very specific
> place (he was making error recovery right before END), that's why
> I didn't disable it.  Sure, it's wrong to play with it, but quickly
> enough you have a grammar that generates an empty language if you
> play too hard, so I didn't care about adding a safety net.

That's fine.  My biggest concern is %type, %destructor, and %printer for 
the end token.  For yacc.c, %destructor isn't normally invoked for the end 
token when it appears in the generated rule 0.  However, for glr.c, it is.  
We'd need to make this consistent if we're going to allow %destructor and 
%type, I think.  Is there any reason to allow it?

I'm also working on the per-type and default %destructor and %printer.  
I'm trying to figure out if they should be used for the end token.  If the 
answer to the above question is no, the answer to this one is easy.

> > > but I need to signal it in my hand written tokenizer(and it is messy to
> > > cast
> > > 0 to the yytokentype enum).
> >
> > I'm guessing this feature was originally intended for no more than just
> > that (and giving the end token a user-friendly string alias).
>
> No it was not.  The original motivation was truly to provide a string
> alias while sticking to the existing interface for the other tokens.

Ok, but I guess you don't object to either usage?

Joel




reply via email to

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