[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: push parser
From: |
Bob Rossi |
Subject: |
Re: push parser |
Date: |
Wed, 20 Sep 2006 22:16:49 -0400 |
User-agent: |
Mutt/1.5.11 |
On Mon, Sep 18, 2006 at 10:34:39AM -0700, Paul Eggert wrote:
> Bob Rossi <address@hidden> writes:
>
> >> Why the #ifdef on YYLTYPE_IS_TRIVIAL? YYLTYPE_IS_TRIVIAL tells
> >> us whether yyltype is trivial (i.e., does not need attention by
> >> C++ storage managers), not whether it exists.
> >
> > OK, I need to determine if YYLTYPE is exists. What's the best way
> > to do that?
>
> b4_locations_if.
>
> >> status = yypushparse (ctx, ch, yylval, yylloc);
> > ...
> > I'm not sure that I like passing all the values into yypushparse though.
> > The problem is, not everyone wants to pass all the values in. We would
> > force them to pass values in that they don't care about which could
> > be confusing.
>
> They always need to pass in ctx, ch, right? And the ", yylloc"
> will be required if b4_locations_if says you're using locations.
> So the only questionable argument will be yylval.
>
> One way to address this issue would be to have two entry points:
>
> status = yypushparse (ctx, ch, yylloc);
>
> for tokens that have no semantic value, and
>
> status = yypushparseval (ctx, ch, yylval, yylloc);
>
> for tokens that do.
>
> Another possibility, which will avoid a copy in some cases if semantic
> values are large, is to pass a pointer:
>
> status = yypushparse (ctx, ch, &yylval, yylloc);
>
> where you pass a NULL pointer if the token has no semantic value. If
> the copying issue is of concern, it may also make sense to pass yylloc's
> address too:
>
> status = yypushparse (ctx, ch, &yylval, &yylloc);
>
> I don't know whether the copying concern is enough to affect
> performance, though.
I'm not decided on how to modify the yypushparse function parameters.
Have you made up your mind?
Attached is a patch on some changes we both agree on. That is remove the
constant 4 from the user and use YYPUSH_MORE. Also, make yypushparse
return an int, instead of void. This has the benefit of removing the
yyresult_get function.
2006-09-20 Bob Rossi <address@hidden>
* data/push.c (yyresult_get): Remove function.
(YYPUSH_MORE): Add #define.
(yypushparse): Modify return value.
Thanks,
Bob Rossi
push.c.diff
Description: Text document
- push parser, Bob Rossi, 2006/09/16
- Re: push parser, Paul Eggert, 2006/09/16
- Re: push parser, Bob Rossi, 2006/09/18
- Re: push parser, Paul Eggert, 2006/09/18
- Re: push parser,
Bob Rossi <=
- Re: push parser, Paul Eggert, 2006/09/21
- Re: push parser, Bob Rossi, 2006/09/21
- Re: push parser, Bob Rossi, 2006/09/25
- Re: push parser, Bob Rossi, 2006/09/25
- Re: push parser, Paul Eggert, 2006/09/26
- Re: push parser, Bob Rossi, 2006/09/26
- Re: push parser, Paul Eggert, 2006/09/26
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser, Paul Eggert, 2006/09/27
- Re: push parser, Bob Rossi, 2006/09/27