[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: default %printer/%destructor
From: |
Joel E. Denny |
Subject: |
Re: FYI: default %printer/%destructor |
Date: |
Sun, 3 Sep 2006 16:46:41 -0400 (EDT) |
On Sun, 3 Sep 2006, Akim Demaille wrote:
>
> > 2006-07-29 Joel E. Denny <address@hidden>
> >
> > + Enable declaration of default %printer/%destructor. Make the parser
> > + use these for all user-declared grammar symbols for which the user
> > does
> > + not declare a specific %printer/%destructor. Thus, the parser uses it
> > + for token 0 if the user declares it but not if Bison generates it as
> > + $end.
>
> Nice work!
Thanks.
I'm beginning to think the declaration is a bit ugly though. How about
something like this instead:
%destructor { free ($$); } %symbol-default
%printer { fprintf (yyoutput, "%s", $$); } %symbol-default
I think that's clearer than just an empty list. Unfortunately, it is yet
another % declaration, but it may have other uses: see here where I called
it %any instead:
http://lists.gnu.org/archive/html/bison-patches/2006-08/msg00033.html
What do you think?
Joel