delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/03:22:34

Message-ID: <19970606092423.55181@gil.physik.rwth-aachen.de>
Date: Fri, 6 Jun 1997 09:24:23 +0200
From: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
To: Tron Thomas <tron DOT thomas AT sierra DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: Can't get YACC parser to run
References: <33970040 DOT 7AF0 AT sierra DOT com>
Mime-Version: 1.0
In-Reply-To: <33970040.7AF0@sierra.com>; from Tron Thomas on Thu, Jun 05, 1997 at 11:06:56AM -0700

On Thu, Jun 05, 1997 at 11:06:56AM -0700, Tron Thomas wrote:
> I reading the book "Lex and Yacc" by John R. Levine, Tonay Mason, and
> Doug Brown.  I am using Flex version 2.5.3 and Bison version 1.25 for
> MS-DOS to run their examples, and I'm compiling the programs using
> Visual C++ 4.2 on Windows '95.
> 
> 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,
> the program crashes.  This is because the main function in the file
> ch1-05.y is defined as follows:
> 
#include <stdio.h>         <<<<<<<<<<<<

> extern FILE *yyin;
> 
> main( )
> {
        yyin=stdin;         <<<<<<<<<<<<
> 	while(!feof(yyin)){
> 		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?

You have to decide what yyin is suppposed to be somewhere in your program,
whether the parser reads from a file or stdin for example.


-- 
--
Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019