[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: push parser
From: |
Paul Eggert |
Subject: |
Re: push parser |
Date: |
Wed, 27 Sep 2006 16:30:43 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Bob Rossi <address@hidden> writes:
> There are no need for global variables, you are correct. The patch I
> originally made simply did not do away with the 4 global variables that
> the user traditionally used. I was a afraid this would break backwards
> compatibility for many users.
OK, but we shouldn't need to worry about doing away with global
variables in push parsers, since they're supposed to be pure. We need
to keep globals only for traditional, impure parsers.
> This was the simplest solution at the time. Now I'm wondering if it
> needs cleaning up, or should simply stay the way it is.
It should be cleaned up, if I understand things correctly.
>> {
>> struct yypvars *ctx = yypvarsinit ();
>> int status;
>> do {
>> YYTOKTYPE token_info;
>> status = yypushparse (ctx, my_lex (&token_info), &token_info);
>> } while (status == YYPUSH_MORE);
>> free (ctx);
>> return status;
>> }
>
> Be careful with the above examples, function parameters can be
> evaluated in either direction, and in the case above, if the compiler
> evaluates right to left, you will get undesired results.
No, there's no problem here, since the example passes token_info's
address to yypushparse, not its value.
> From your comments below, I'm assuming that the user will think it's
> there responsibility to do this. In that case, I like the idea of
> having them declare the data, and passing it into yypushparse. In
> this case, the ctx cares nothing about this data.
OK, thanks, that sounds good.
- Re: push parser, (continued)
- Re: push parser, Bob Rossi, 2006/09/26
- Re: push parser, Paul Eggert, 2006/09/26
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser, Paul Eggert, 2006/09/27
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser, Paul Eggert, 2006/09/27
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser, Paul Eggert, 2006/09/27
- Re: push parser, Bob Rossi, 2006/09/27
- Re: push parser,
Paul Eggert <=
- Re: push parser, Bob Rossi, 2006/09/29
- Re: push parser, Bob Rossi, 2006/09/29
- Re: push parser, Paul Eggert, 2006/09/29
- Re: push parser, Bob Rossi, 2006/09/29
- Re: push parser, Paul Eggert, 2006/09/29
- Re: push parser, Bob Rossi, 2006/09/29
Re: push parser, Frans Englich, 2006/09/21