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: Mon, 11 Sep 2006 15:48:37 -0400
User-agent: Mutt/1.5.11

On Mon, Sep 11, 2006 at 12:32:51PM -0700, Paul Eggert wrote:
> Bob Rossi <address@hidden> writes:
> 
> > - Does it make sense to use these options together? (I don't know what
> >   %parse-param is used for)
> 
> I suspect it does.  %parse-param is used to specify extra options
> given to yyparse and friends.  I'd expect a push parser would
> always want to use %parse-param, no?  So you can make it an error
> if someone tries to define a push parser without parameters.
> And then, given:
> 
>   %parse-param {semantic_value *result}
>   %parse-param {int *count}
> 
> you can generate:
> 
>   void yyparse (semantic_value *result, int *count);
> 
> (perhaps with extra args? I don't know what a push parser needs) instead of:
> 
>   void yyparse (void *PVVOID);

OK, I see. So, currently, when you choose push-parser, I have the
skeleton generate a function prototype:
  void yyparse (void *PVVOID);

Do you suggest I keep this functionality, and allow the user to use
the %parse-param option on top of that? or do you suggest I should 
not automatically generate the "void *PVVOID" parameter, and force the
user to use %pase-param along with %push-parser?

> > - Should I generate a yypushparse function instead to avoid this
> >   problem?
> 
> This would make sense, if you plan to be able to generate both
> functions in the same module.  Is that a reasonable thing to do?

Yes, this is a possible thing to do, but I guess it doesn't make much
sense the more I think about it. Basically, here are the case's.

- push.c skeleton is the same as yacc.c skeleton
- push.c skeleton with %pure-parser is the same as yacc.c skeleton with
  %pure-parser
- push.c skeleton with %push-parser generates the push parser.

So, there is currently no reason to choose the %push-parser, and expect
to get a push and pull parser even if one is implemented on top of the
other. Maybe we will leave this for another exercise.

> > - Should I make the push-parser handle those extra parameters when
> >   %parse-param is used? (ie)
> >   void yyparse (void *PVVOID, semantic_value *result, int *count);
> 
> Yes, I think that'll be helpful.

OK, thanks, please answer my above question, and I'll get back to work
on this.

Thanks!
Bob Rossi




reply via email to

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