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: Wed, 11 Oct 2006 16:46:34 -0400
User-agent: Mutt/1.5.11

On Tue, Oct 10, 2006 at 03:19:51PM -0700, Paul Eggert wrote:
> Bob Rossi <address@hidden> writes:
> 
> > --- yacc.c  2006-10-10 14:06:22.000000000 -0400
> > +++ push.c  2006-10-10 10:49:23.000000000 -0400
> >     @@ -152,6 +152,9 @@
> >      m4_if(b4_prefix, [yy], [],
> >      [/* Substitute the variable and function names.  */
> >      #define yyparse b4_prefix[]parse
> >     +#define yypushparse b4_prefix[]pushparse
> >     +#define yypvarsinit b4_prefix[]pvarsinit
> >     +#define yypvars b4_prefix[]pvars
> >      #define yylex   b4_prefix[]lex
> >      #define yyerror b4_prefix[]error
> >      #define yylval  b4_prefix[]lval
> >
> > These are 3 new symbols that get defined depending on the prefix.
> 
> Are these symbols needed if it's not a push parser?  If not, perhaps
> they should be protected with b4_push_if.  Similarly for any other
> changes needed only for the push parser.

OK fixed in this patch.
> >     @@ -1023,6 +1136,7 @@
> >      
> >        /* The state stack.  */
> >        yytype_int16 yyssa[YYINITDEPTH];
> >     +  yytype_int16 *yyssa_ptr = yyssa;
> >        yytype_int16 *yyss = yyssa;
> >        yytype_int16 *yyssp;
> >
> > Same idea as above here.
> >  
> >     @@ -1037,7 +1151,9 @@
> >        YYLTYPE *yyls = yylsa;
> >        YYLTYPE *yylsp;
> >        /* The locations where the error started and ended.  */
> >     -  YYLTYPE yyerror_range[2];]])[
> >     +  YYLTYPE yyerror_range[2];
> >     +  YYLTYPE *yyerror_range_ptr = yyerror_range;
> >     +  ]])[
> >
> > Again, same idea.
> 
> I guess this is different from yymsgbuf_ptr, since this storage does
> need to survive from one call to the next.  But I don't see why the
> pointers are needed here, either.  If it's always the case that
> yyssa_ptr == pv->yyssa then you can simply use pv->yyssa rather than
> maintaining a separate pointer.  Likewise for yyerror_range_ptr.

OK, fixed in this patch also.

I hope doing this in small patches is easier, that's why I'm sending
them in this way. Did you have any other complaints regarding the 
differences between the push and yacc parser?

Thanks,
Bob Rossi

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

       * data/push.c (yypushparse, yypvarsinit, yypvars): Wrap in
         b4_push_if.
       (b4_yyssa, b4_yyerror_range): New macros.
       (struct yypvars): Remove yyssa_ptr and yyerror_range_ptr fields.
       (yypvarsinit): Remove init of removed fields.
       (yypushparse): Remove use of removed fields, use new macros
        instead.


Attachment: push-ptr.diff
Description: Text document


reply via email to

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