List Info

Thread: default action in yydestruct




default action in yydestruct
user name
2006-06-21 20:15:21
Is it possible to add a default action to yydestruct?

Two reasons:
1. For most of the tokens, the action is the same, e.g
free the memory. Only for a few tokens one want to
customize the behavior - that's where %destructor can
be put to best use.
2. In a large grammar, forgetting to add a token to
the %destructor directive can cause a lot of
grievance. A default action can serve as a safety net.

I'm thinking about an optional macro, similar to
YYPRINT. The default is do nothing. User can define
their own. It's probably cheap to add, only the m4
files need to be touched.

Thanks, -zl




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around 
http://mail.yahoo.com 


_______________________________________________
help-bisongnu.org http
://lists.gnu.org/mailman/listinfo/help-bison
default action in yydestruct
user name
2006-06-21 20:20:48
On Wed, 21 Jun 2006, Z Liu wrote:

> Is it possible to add a default action to yydestruct?

Not yet, but we've just been discussing adding this as well
as destructors 
by semantic type.  I make no promises, but I believe it'll
be possible in 
Bison 2.4.

Joel


_______________________________________________
help-bisongnu.org http
://lists.gnu.org/mailman/listinfo/help-bison
default action in yydestruct
user name
2006-07-12 11:53:47
On Wednesday 21 June 2006 20:20, Joel E. Denny wrote:
> On Wed, 21 Jun 2006, Z Liu wrote:
> > Is it possible to add a default action to
yydestruct?
>
> Not yet, but we've just been discussing adding this as
well as destructors
> by semantic type.  I make no promises, but I believe
it'll be possible in
> Bison 2.4.

Something that perhaps could be useful is if the debug
output file contains 
info on what token/types that no destructors exists for.
That list could 
first be printed if destructors are used at all, in order to
not produce the 
output in case destructors aren't used.


Just a thought,

		Frans


_______________________________________________
help-bisongnu.org http
://lists.gnu.org/mailman/listinfo/help-bison
default action in yydestruct
user name
2006-07-12 18:48:09
On Wed, 12 Jul 2006, Frans Englich wrote:

> Something that perhaps could be useful is if the debug
output file contains 
> info on what token/types that no destructors exists
for. That list could 
> first be printed if destructors are used at all, in
order to not produce the 
> output in case destructors aren't used.

I agree.  For each symbol that does have a
destructor/printer, the 
location of the chosen %destructor/%printer from the grammar
file might 
also be nice.  For example, this might help anyone who
hasn't grasped the 
precedence rules: per-symbol overrides per-type overrides
default.

Joel


_______________________________________________
help-bisongnu.org http
://lists.gnu.org/mailman/listinfo/help-bison
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )