/*Regular Definitions*/
delim[\t\n]
WS{delim}+
letter[A-Za-z]
digit[0-9]
id{letter}({letter|digit})*
number{digit}+(\.{digit}+?(E[+-]?{digit}+)?
%%
{WS}{/*do nothing*/}
if{printf("\nIF found");return 0;}
then{printf("\nTHEN found");return 0;}
else{printf("\nELSE found");return 0;}
{id}{printf("\nID found");return 0;}
{number}{printf("\nNUMBER found");return 0;}
"<"{printf("\nLess than symbol found.");return 0;}
"<="{printf("\nLess than or Equals to symbol found.");return 0;}
"="{printf("\nEquals to symbol found.");return 0;}
"<>"{printf("\nNot equals to symbol found.");return 0;}
">"{printf("\nGreater than symbol found.");return 0;}
">="{printf("\nGreater than or equal to symbol found.");return 0;}
%%
雖然使用Flex編譯此錯誤與Flex工具
G:\>flex Lex.l
我收到以下錯誤:
"Lex.l", line 14: unrecognized rule
"Lex.l", line 14: unrecognized rule
"Lex.l", line 14: unrecognized rule
"Lex.l", line 14: unrecognized rule
"Lex.l", line 14: unrecognized rule
"Lex.l", line 27: EOF encountered inside an action
誰能幫助我呢?
謝謝。
我編輯了問題補充編譯代碼標籤之間的誤差。它更容易閱讀。 – Birei 2012-02-15 15:27:38