fork download
  1. ALPHA [a-zA-Z]
  2. DIGIT[0-9]
  3. sp[" "\n]
  4.  
  5. %{
  6. int numwords=0,numlines=0,numws=0;
  7. %}
  8.  
  9. %%
  10. \n ++numlines, ++numws;
  11. {sp} ++numws;
  12. (ALPHA}({ALPHA}|{DIGIT})* ++numwords;
  13. ["][ALPHA}+["] ++numwords;
  14. %%
  15.  
  16. main()
  17. {
  18. yylex();
  19. printf("No.of words=%d\nNo.of lines=%d\nNo.of white spaces=%d in", numwords, numlines, numws);
  20. }
Success #stdin #stdout #stderr 0.03s 5776KB
stdin
Hi how
Are you
stdout
Standard output is empty
stderr
ERROR: /home/run-20105/prog:20:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? EOF: exit