title: segmentation fault with bison and flex
body: <p>I was trying learn lex and yacc using the oreilly book. I tried following example from book, but it gives segmentation fault. </p>
  
  <pre><code>%{
   /**
    * A lexer for the basic grammar to use for recognizing English sentences.
    */
  
    #include &lt;stdio.h&gt;
    extern FILE *yyin;
  %}
  
  %token NOUN PRONOUN VERB ADVERB ADJECTIVE PREPOSITION CONJUNCTION
  
  %%
  sentence: subject VERB object{ printf("Sentence is valid.\n");}
   ;
  
  subject: NOUN
   | PRONOUN
   ;
  object:  NOUN
   ;
  %%
  
  
  main()
  {
   while(!feof(yyin)) {
    yyparse();
   }
  
  }
  yyerror(char *s)
  {
   fprintf(stderr, "%s\n", s);
  }
  </code></pre>
  
  <p>i'm using flex and bison. 
  I'm getting segmentation fault in main function, in the while loop. It is not entering at all to the loop.</p>
  
  <p>Any thoughts?
  Thanks,
  Robert</p>