1

我对 flex 很陌生,我不知道为什么我的定义无效。我确定我犯了一些简单的错误。这是我的代码示例,缺少的部分是类似的定义和规则。关于为什么它不会编译的任何见解?

%{
include <math.h>
%}

DIGIT [0-9]
NUM {DIGIT}+"."{DIGIT}+

%%
{NUM}+   {printf("%f ", atof(yytext());}
%%
4

1 回答 1

0

更正以下内容:

#include <math.h>
...
printf("%f ", atof(yytext));

编译器错误消息有点误导..

于 2013-03-26T15:41:01.730 回答