bison-patches
[Top][All Lists]
Advanced

[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, 7 Sep 2006 09:21:23 -0400
User-agent: Mutt/1.5.11

On Sat, Aug 19, 2006 at 06:01:15PM -0400, Bob Rossi wrote:
> On Fri, Aug 18, 2006 at 08:57:01PM -0700, Paul Eggert wrote:
> > Bob Rossi <address@hidden> writes:
> > 
> > > What should the steps be?
> > 
> > I'd prepare a diff -u patch against Bison CVS, and publish it on
> > bison-patches.  It should have documentation and test cases.  If you
> > have questions, feel free to publish an incomplete patch but please
> > let us know where the holes are.
> > 
> > In practice, I find the documentation is the hardest to do well --
> > it's often harder than the implementation.  But perhaps that's just me.
> 
> OK, don't expect anything to soon, however, it'll be coming.

OK, I have got the push.c skeleton working with CVS. It's not very
different from yacc.c and can be merged into it when ready. I would
appreciate it if this could be read and responded to in a timely manner,
since I don't have a lot of time to work on this, and switching to and
from it is painful. Thanks!

Here is what the user will do in push-parser mode:
  struct yypvars *ctx = yypvarsinit ();
  do {
    set_yychar (ctx, yylex ());
    ctx->yylval = yylval;
    yyparse (ctx);
  } while (get_yyresult (ctx) != 0);
  free (ctx);

Here is my current status, and I'd like to know what you think, and what
direction I should go in.

1. I've Added the %push-parser option
   push.c works in both push and pull mode. If you set the %push-parser 
   option, it will work in push mode, otherwise pull mode. Depending on the 
   mode, you will get a different yyparse function. It was mentioned
   that the pull parser could be implemented be using the push mode.
   Should I do this?
2. struct yypvars and yypvarsinit
    Adding the struct yypvars that contains all the data needed to do the
    parse. yypvarsinit is a user visible function that inits the struct.
    Should I add a yypvarsdestroy? or just let the user do a free ()?
3. yychar, yylval, yynerrs, and yylloc (external parser variables)
    These variables remain external in the default parser. However, in
    the pure and push parser they go in the struct yypvars. So, I'm 
    currently making accessor functions to access them. I currently only
    have:
        int get_yyresult (void *PVVOID);
        void set_yychar (void *PVVOID, int yychar);
    because they are the only 2 I need. However, should I just generate
    all 4 pairs of set/get functions for yychar, yylval, yynerrs, and
    yylloc?
5. Test suite.
    What should I do to modify the test suite?
6. Documentation
    New chapter?

Any suggestions? ideas?

Thanks,
Bob Rossi






reply via email to

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