0
好話題爲自己代言的一個代碼在這裏的例子(編譯之前的lex文件):試圖在vs13運行時語法錯誤:「常量」,而使用柔性
%{
#include<stdio.h>
int Upperc=0;
int Lowerc=0;
%}
%%
[A-Z] {printf("Upperccase\t");Upperc++;}
[a-z] {printf("Lowerccase\t");Lowerc++;}
%%
main()
{
printf("Enter a string\n");
yylex();
printf("Upperccase=%d and Lowerccase=%d",Upperc,Lowerc);
}
出於某種原因,我總是得到syntax error: 'constant'
,除此之外沒有任何線路或任何有關錯誤的信息, 請幫助我瞭解什麼是錯誤的,謝謝!
奔跑對我來說很好(flex 2.5.35,Ubuntu) – DyZ
對我來說也適用,使用flex 2.5.37/gcc 4.8.5。確保你沒有試圖將Flex輸入編譯爲C源代碼。 –
我寫了一個錯誤的信息,它與vs13,安裝vs10後,它被修復....(我不知道這是否是問題或什麼..) – WilliamW