premature eof error in flex file

The problem is with your %} - flex is very sensitive about spacing. Remove the space before it, and all should be well.

Also, if you don't want a yywrap function, you can stick %option noyywrap in your flex file.


Change this:

%{

  #include <stdlib.h>
  #include "y.tab.h"

  %}

To this:

%{

  #include <stdlib.h>
  #include "y.tab.h"

%}

It works with flex 2.5.35 (mingw)