Flex gives error for every character in file

I'm trying to get flex and bison working on my windows machine. I have installed flex, bison, and mingw compiler. i have a file named test.l in my flex bin folder that contains the following code:

%{
int chars = 0;
%}

%%
. { chars++; }
%%

main()
{
  yylex();
  printf("yay: %d", chars);
}

Flex is giving me nine bad character errors from line one, then a few "unknown error processing section 1" errors. Each line is about the same, give or take a few unknown character errors. Final error is premature EOF at the end of line 13.

Is this a sign that I have things installed incorrectly, or have I seriously messed up somewhere in this simple test file?

链接地址: http://www.djcxy.com/p/57874.html

上一篇: Flex:无法识别的规则错误

下一篇: Flex会为文件中的每个字符提供错误