bison-patches
[Top][All Lists]
Advanced

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

Re: push parser


From: Paul Eggert
Subject: Re: push parser
Date: Wed, 11 Oct 2006 22:48:52 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bob Rossi <address@hidden> writes:

> Well, in the case of the pull parser, the yyssa[YYINITDEPTH] is declared
> on the stack. In the case of the push parser, it's declared in the
> struct yypvars.
>
> What would you suggest I do?

I'd put the yyssa[YYINITDEPTH] declaration into a macro (either C or
M4; not sure), and use that macro both in the push parser's struct
yypvars and in the pull parser's stack.  Similarly for other decls
that are in the same boat.  That way, the code isn't repeated.

> It's also declared on the stack in this case, but never used.

We want to avoid unused local variables; many compilers complain about
them.

>> I'd rather not use M4 macros if the problem can be solved easily at
>> the C level.  Can't we just do this at the start of the yypushparse
>> function instead?
>> 
>>     yytype_int16 *yyssa = pv->yyssa;
>>     YYLTYPE *yyerror_range = pv->yyerror_range;
>> 
>> That way, the rest of the code can just say 'yyssa' and 'yyerror_range'
>> rather than ']b4_yyssa[' etc.
>
> I think we are going in circles a little bit. Are you suggesting I
> create a new pointer variable on the stack, and assign it pv->yyssa in
> push mode, and yyssa in pull mode?

No, we can leave the pull-mode code alone.  The pointer variable
would be created only for push mode.

> Also, it would be helpful to me if you could apply the larger patch I
> ping'd about to push.

OK, done.




reply via email to

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