[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: Sat, 1 Apr 2006 14:43:25 -0500
User-agent: Mutt/1.5.9i

On Sun, Mar 26, 2006 at 09:01:33AM -0500, Bob Rossi wrote:
> On Fri, Mar 24, 2006 at 10:01:16AM -0800, Paul Eggert wrote:
> > "Joel E. Denny" <address@hidden> writes:
> > 
> > > Sorry for the silence on our part.  I think everyone must be very busy.  
> > 
> > Yup.  I'll have some more time next week, I think.
> > 
> > > On top of that, there seems to be some delay on completing 2.2,
> > 
> > This is more a licensing issue.  I guess we'll have to ship 2.2 with
> > the old license.
> > 
> > (Personally I'd trust your or Akim's review over mine.  :-)
> Thanks for the responds everyone. I know these things take time, I just
> wanted to make sure I wasn't being swept under the rug.
> I do see one problem while testing the parser after the patch. Some of
> my actions are not being reached, which makes me think I've corrupted
> the parser. Basically, this is the first action that is hit,
>   opt_oob_record_list: {
>               $$ = NULL;
>   };
> Any idea what could cause this? I'll do some more digging.

OK, I've fixed the problem, and it had nothing to do with the patch. I
simply didn't call yyparse () one last time when the input was done.

Along with this Email is the Two week ping. :)

Again, this doesn't have to be a final patch review, I'd like
suggestions on how to finish my work. The main things are this,

1. Adding the %push-parser option
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.
    Is another interface preferable to do this?
    Does the struct field members slow the parser down?
    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.
4. User visibility into the struct yypvars.
    There are 4 variables that users traditionally use. Should we have
    set/get functions to access them? Any other suggestions?
    Odd's implementation had a unique integer in the struct representing 
    what parser struct this is. Should we also add that functionality or
    leave it to the client to do? 
    Again, Odd's parser has a second struct with the user visible
    fields. I thought that approach was a little more confusing to the
    user, so combined the data into 1 structure.
5. Test suite.
    What should I do to modify the test suite?
6. Documentation
    New chapter?

Here is what the interface looks like from the user's perspective

main (void)
  void *ctx = yypvarsinit ();
  FILE *fp;
  int val = 1;
  fp= fopen("1.dat", "r");
  yyparse (ctx);
  do {
    if(val != 0)
     set_yychar (ctx, yylex(fp));
    val = get_yyresult (ctx);
    if(val == 1)
      fprintf(stderr,"\nSyntax error");
  } while (val!=0);

  fprintf(stderr, "\n");
  return 0;

It's important to realize that yyparse needs to be called once to init
the parser. It also needs to be called once after calling
set_yychar (ctx, 0).

Any suggestions? ideas?

Bob Rossi

reply via email to

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