[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: |
Sun, 2 Apr 2006 09:11:01 -0400 |
User-agent: |
Mutt/1.5.9i |
> Here is what the interface looks like from the user's perspective
>
> int
> 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));
> yyparse(ctx);
> val = get_yyresult (ctx);
> if(val == 1)
> fprintf(stderr,"\nSyntax error");
> } while (val!=0);
> fclose(fp);
>
> fprintf(stderr, "\n");
> return 0;
> }
>
> It's important to realize that yyparse needs to be called once to init
> the parser.
Hmm, I think this isn't necessary. I just thought it was. The yyparse
(ctx) call is not necessary before the 'do {' line.
Bob Rossi
- Re: push parser implemenation, Bob Rossi, 2006/04/01
- Re: push parser implemenation,
Bob Rossi <=
- Re: push parser implemenation, Bob Rossi, 2006/04/02
- Re: push parser implemenation, Paul Eggert, 2006/04/04
- Re: push parser implemenation, Bob Rossi, 2006/04/04
- Re: push parser implemenation, Paul Eggert, 2006/04/05
- Re: push parser implemenation, Bob Rossi, 2006/04/05
- Re: push parser implemenation, Bob Rossi, 2006/04/05
- Re: push parser implemenation, Akim Demaille, 2006/04/06
- Re: push parser implemenation, Frans Englich, 2006/04/05
- Re: push parser implemenation, Bob Rossi, 2006/04/05
- Re: push parser implemenation, Frans Englich, 2006/04/05