bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: default %printer/%destructor


From: Akim Demaille
Subject: Re: FYI: default %printer/%destructor
Date: Thu, 14 Sep 2006 10:43:32 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

>>> "Joel" == Joel E Denny <address@hidden> writes:

 > 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.

I don't like the empty either, and I meant to introduce $empty-word or
$epsilon, or whatever for empty rhs too.  Maybe we should use a single
token for all these uses?

Alternatively, we can introduce %default-printer {};.

 > 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?

How about taking this opportunity to treat differently symbols with a
value from those without?

%printer { cerr << @$ << ": " << $$; } %valued-symbols
%printer { cerr << @$; } %valueless-symbols

Or

%default-valued-printer { cerr << @$ << ": " << $$; }
%default-valueless-printer { cerr << @$; }





reply via email to

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