[Top][All Lists]

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

Re: push parser implemenation

From: Bob Rossi
Subject: Re: push parser implemenation
Date: Thu, 14 Sep 2006 11:50:50 -0400
User-agent: Mutt/1.5.11

On Thu, Sep 14, 2006 at 05:25:09PM +0200, Akim Demaille wrote:
> >>> "Bob" == Bob Rossi <address@hidden> writes:
>  > Well, currently, push.c only implements yyparse (). If it's in normal
>  > mode it generates the standard pull parser, otherwise in push mode it
>  > generates the push parser. In push.c the pull parser is just as
>  > efficient as the yacc.c pull parser. Same for the pure parser. However,
>  > the push parser is much less efficient. (I get 30% for the benchmark).
> So my reading is: there is no reason not to use push.c as the new yacc.c.

At this point, I don't see one. Except of course that I have to deal
with the %parse-param issue in %push-parse mode. The entire test suite 
passes with push.c replacing yacc.c.

>  > So, if we decided to change push.c to always generate a yypushparse
>  > function, and then implement yyparse on top of the yypushparse,
>  > then yyparse will be significantly slower than yacc.c's
>  > yyparse. That's why I decided not to go down this route. I thought
>  > the efficiency was probably more important.
> That's not exactly my claim: I say that yyparse should always (push
> enabled or not) refer to the pull parser.  When the push mode is
> enabled, yyparse should refer to the yypushparse wrapper.

OK, I don't know why this is confusing to me. Let me try to explain
myself clearly.

You would like yyparse to always be in pull mode, regardless of the
option. This is probably possible, but with my current patch, won't
work. The problem is, I modify the yyparse () function (with m4) when 
the %push-parser option is enabled. For example, in the pull yyparse
function, this is done at some point:
  goto yysetstate
in the push yyparse function, this is done instead:
  +[  ]b4_push_if([
  +        /* Initialize the locals to the current context. */
  +       yychar        = pv->yychar;
  +       yylval        = pv->yylval;
  +       yynerrs       = pv->yynerrs;
  +  goto yysetstate;

Do you see what I mean? Now that I've bored you with tecnical details,
do you have an idea that would overcome these problems in order to
achieve your objective?

Bob Rossi

reply via email to

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