Mail Archives: djgpp/1997/06/06/09:47:48
On Thu, 5 Jun 1997, Tron Thomas wrote:
> I reading the book "Lex and Yacc" by John R. Levine, Tonay Mason, and
> I created the program in example 1-7 (a Yacc Parser) of chapter one, but
> I'm not sure how I'm supposed to run it. When I just try to launch it,
> extern FILE *yyin;
> main( )
Oh no another BAD example from some book! The function main() MUST
ALWAYS return an int and if you do not use the standard argument list you
should declare the list void. Hence either:
int main( void )
int main( int argc, char **argv )
You need to initialize yyin to some file either:
yyin = stdin;
yyin = fopen( "mytestfile", "r" );
BTW you need to include stdio.h and should also include stdlib.h.
> yyparse( );
> When I trace through this code yyin = 0 causing the program to crash on
> the call to feof.
> Can somebody tell me what I need to do to get this program to run?
Art S. Kagel, kagel AT bloomberg DOT com
- Raw text -