fork download
  1. %{
  2. #include<stdio.h>
  3. int s=0,c=0,w=0;
  4. %}
  5. %%
  6. [ \t\n]+ { s++, c++;}
  7. [^ \t\n]+ {w++,c=c+yyleng;}
  8. %%
  9. int main(){
  10. yylex();
  11. printf("character: %d, word: %d, space: %d\n",c,w,s);
  12. return 0;
  13. }
  14. int yywrap(){
  15. returnĀ 1;
  16. }
Success #stdin #stdout #stderr 0.02s 6860KB
stdin
hi   hi 
ax
stdout
Standard output is empty
stderr
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