delim [" "\n\t]
whitespace {delim}+
words {chars}+
%%
while {ECHO; printf("%s\n",yytext);}
{words} { wordCount++;
/* increase the word count by one*/ }
{whitespace} { /* do nothing*/ }
([0-9])+ { numcount++; /* one may want to add some processing here*/ }
%%
void main()
{
printf("ok1\n");
yylex(); /* start the analysis*/
printf("ok2\n");
printf(" No of words: %d\n number: %d\n", wordCount, numcount);
return 0;
}
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库Win7下lex_与_yacc的安装配置(3)在线全文阅读。
相关推荐: