wc.l
来自「YYCC语言编译器」· L 代码 · 共 27 行
L
27 行
%{
/************************************************************
wc.l
Simple word count program. main is defined in the programs
section since the one in the library calls yyparse instead.
************************************************************/
int wc = 0; /* word count */
%}
%%
[a-zA-Z]+ { wc++; }
\n|. { /* gobble up */ }
%%
int main(void)
{
int n = yylex();
return n;
}
int yywrap(void)
{
printf("word count: %d\n", wc);
return 1;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?