bison-patches
[Top][All Lists]
Advanced

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

Re: push parser


From: Bob Rossi
Subject: Re: push parser
Date: Mon, 2 Oct 2006 10:24:36 -0400
User-agent: Mutt/1.5.11

On Fri, Sep 29, 2006 at 11:30:51PM -0400, Bob Rossi wrote:
> On Fri, Sep 29, 2006 at 05:55:08PM -0700, Paul Eggert wrote:
> > Bob Rossi <address@hidden> writes:
> > 
> > > If we force the user to define that function, it add's an unnecessary 
> > > complication to the push parser. That is, the user is mostly likely 
> > > going to call yypushparse, and not care about yyparse at all. However,
> > > yyparse is the function causing the user to define the yypushlex
> > > function. What do you think I should do to resolve this?
> > 
> > Ah, sorry, I didn't understand this issue at all.
> > 
> > It sounds to me like the push parser shouldn't define yyparse.  That
> > way, the user shouldn't have to care about any lexer function.
> 
> I agree. Akim, you were the main advocate for adding this functionality. Can
> you see any other solution to the problem besides remove yyparse from
> the generated output?

Akim, when you get around to this, let me know what your thoughts are.
For now, I've removed yyparse again in push mode. It can be easily added
back ...

Paul, I think we are getting closer to a userful interface for the user.
Below is what it currently looks like.

  struct yypvars *ctx = yypvarsinit ();
  int status;
  YYSTYPE my_lval;
  YYLTYPE my_lloc;
  do {
    status = yypushparse (ctx, yylex (&my_lval, &my_lloc), &my_lval, &my_lloc)
  } while (status == YYPUSH_MORE);
  free (ctx);

The user is forced to pass in NULL to my_lval. When locations are turned
on the extra parameter will also have to be passed in. Otherwise, not.

How is this looking? I'm starting to like it much better than what was 
previously done.

Thanks,
Bob Rossi

2006-10-02  Bob Rossi  <address@hidden>

        * data/push.c (yychar_set, yylval_set, yylloc_set): Delete.
        (yypushparse): Add yynchar, yynlval, yynlloc parameters.
        (b4_declare_parser_variables): Do not declare yynerrs for push mode.
        (struct yypvars): Remove b4_declare_parser_variables.
        (yypvarsinit): Remove init code for removed variables.
        (global scope): Do not declare b4_declare_parser_variables if
        push or pure mode.
        (yypushparse): Add b4_declare_parser_variables.
        Init new local variables, and remove init code for removed
        yypvars variables.
        (yyparse): Delete.
        * tests/calc.at (_AT_DATA_CALC_Y): Call yypushparse for push mode
        and yyparse for other modes.
        * tests/local.at (AT_PUSH_IF): Added.
        (AT_PURE_IF): Rename to AT_PURE_OR_PUSH_IF and modify accordingly.
        (AT_PURE_AND_LOC_IF): Rename to AT_PURE_OR_PUSH_AND_LOC_IF and
        modify accordingly.
        (AT_YYERROR_ARG_LOC_IF): Use AT_PURE_OR_PUSH_AND_LOC_IF.
        (AT_YYERROR_SEES_LOC_IF): Use AT_PURE_OR_PUSH_IF.
        (AT_PURE_LEX_IF): Use AT_PURE_OR_PUSH_IF.


Attachment: push.c.diff
Description: Text document


reply via email to

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