title: flex/bison not terminating on <<EOF>>
body: <p>I have a simple project using flex/bison. I'm trying to parse a text file, but it doesn't quits parsing (apparently a loop at end of file).</p>
  
  <p>My flex code:</p>
  
  <pre><code>%{
  #include "y.tab.h"
  %}
  %%
  [0-9]                           { printf("digit: %s\n",yytext); return DIGIT; }
  [a-zA-ZáéíóúÁÉÍÓÚçÇãõÃÕ]+       { printf("word: %s\n",yytext); return WORD; }
  
  [\.]                            
  [ ]        
  [\n]             
  
  .                               { printf("other: %s\n",yytext); return OTHER; }
  
  &lt;&lt;EOF&gt;&gt;                         { yyterminate(); return 0; }
  %%
  </code></pre>
  
  <p>My bison code:</p>
  
  <pre><code>%{
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  %}
  
  %token DIGIT WORD OTHER SPACE
  
  %%
  start :
      text
      ;
  
  text :
      | WORD text
      ;
  
  %%
  
  extern FILE *yyin;
  
  main()
  {
      printf("Translating...\n");
      printf("\n");
  
      if ((yyin = fopen("/home/nilo/text","r")) == NULL)
      {
          fprintf(stderr,"File not found or not readable.\n");
          exit(1);
      }
  
      // Start the parser
      yyparse();
  
      fprintf(stderr,"Parser ended...\n");
  }
  
  yyerror(s)
  char *s;
  {
      printf("yacc error: %s\n", s);
  }
  
  yywrap()
  {
      return(0);
  }
  </code></pre>
  
  <p>I've already tried not to put <code>&lt;&lt;EOF&gt;&gt;</code> rule and some other things related to this, like calling yyterminate(), calling return 0, both things, etc., but no success.</p>
  
  <p>Can someone tell me what I'm missing?</p>
  
  <p>TIA.</p>