语法错误:使用flex时'常量'

时间:2017-04-11 21:06:03

标签: c visual-studio compilation flex-lexer lex

好主题为自己说话,这里是代码示例(编译前的lex文件):

%{

#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);
}

由于某种原因,当我试图在vs13上运行时,我总是得到syntax error: 'constant',除了这个之外没有任何关于错误的行或任何信息, 请帮我理解出了什么问题,谢谢!

1 个答案:

答案 0 :(得分:1)

好吧,因为似乎在5小时后没有理解问题(在这里发布后20分钟,问题出在VS13上,安装VS10之后一切都已修好...... 谢谢大家!

相关问题