> 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


Reply via email to