help-bison
[Top][All Lists]
Advanced

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

Re: Non-greedy wildcard possible? (Long)


From: Frank Heckenbach
Subject: Re: Non-greedy wildcard possible? (Long)
Date: Wed, 19 May 2004 14:26:53 +0200
User-agent: semail 20040101

Laurence Finston wrote:

> > > In most places, I've used CWEB
> > > sections for this purpose, however I've started to use functions
> > > instead, where possible, despite the inconvenience.
> >
> > BTW, which inconvenience? I've never found any. Of course, I have to
> > pass `$n' as arguments as required and usually assign the result to
> > `$$', but that's quite simple and "looks nice"
> > (foo: bar baz { $$ = foo ($1, $2); };).
> >
> 
> Passing the strings for debugging and/or error output
> can be a bit inconvenient.  I also have the cost of a function call,
> which seems to me to be too expensive, if the function doesn't contain
> much code.

As you noted, inlining can help. But if the function doesn't contain
much code, you may not need the function (or a goto), of course. I
also don't do it for one-line statements.

> If I want to return more than one value to the rule, then I either
> have to define a `class' to contain the values, if I haven't already
> defined an appropriate one, or pass pointers (or references) as
> additional arguments for storing the values.  (I can't use global
> variables because of race conditions).

In the end it must go to `$$' anyway, so it seems you can always
assign the result to `$$' and/or pass something like `&$$' by
reference.

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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