%{ #include<stdio.h> int s=0,c=0,w=0; %} %% [ \t\n]+ { s++, c++;} [^ \t\n]+ {w++,c=c+yyleng;} %% int main(){ yylex(); printf("character: %d, word: %d, space: %d\n",c,w,s); return 0; } int yywrap(){ returnĀ 1; }
hi hi ax
Standard output is empty
ERROR: /home/vXZxnU/prog:16:0: Syntax error: Unexpected end of file ERROR: '$runtoplevel'/0: Undefined procedure: program/0 Exception: (3) program ? Options: +: spy -: no spy /c|e|r|f|u|a goal: find .: repeat find a: abort A: alternatives b: break c (ret, space): creep [depth] d: depth e: exit f: fail [ndepth] g: goals (backtrace) h (?): help i: ignore l: leap L: listing n: no debug p: print r: retry s: skip u: up w: write m: exception details C: toggle show context Exception: (3) program ? EOF: exit