fork download
  1. %{
  2. int word_count = 0;
  3. %}
  4.  
  5. %%
  6. [a-zA-Z0-9]+ { word_count++; } // Match a word
  7. [ \t\n]+ { /* skip whitespace */ }
  8. . { /* ignore other characters */ }
  9. %%
  10.  
  11. int main() {
  12. yylex();
  13. printf("Total number of words: %d\n", word_count);
  14. return 0;
  15. }
  16.  
  17. int yywrap() {
  18.     return 1;
  19. }
Success #stdin #stdout #stderr 0.03s 7044KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/UJlMTK/prog:2:4: Syntax error: Operator expected
ERROR: /home/UJlMTK/prog:19:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit