fork download
  1. %{
  2. #include <stdio.h>
  3. int lines = 0 , spaces = 0 , tabs = 0 , others = 0;
  4. %}
  5.  
  6. %%
  7. \n {lines++;}
  8. " " {spaces++;};
  9. \t {tabs++;}
  10. . {others++;}
  11. %%
  12.  
  13. int main(){
  14. printf("Enter string:");
  15. yylex();
  16. printf("%d\n%d\n%d\n%d",lines,spaces,tabs,others);
  17. return 0;
  18. }
  19.  
  20. int yywrap(){
  21. return 1;
  22. }
Success #stdin #stdout #stderr 0.02s 6860KB
stdin
hello world
hello
stdout
Standard output is empty
stderr
ERROR: /home/K9m7CE/prog:2:3: Syntax error: Operator expected
ERROR: /home/K9m7CE/prog:22: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