fork download
  1. %{ #include<stdio.h>
  2. int line=0, word=0, ch=0;
  3. %}
  4. %%
  5. [a-z|A-Z|0-9] {ch++;}
  6. " " {word++;}
  7. "\n" {line++; word++;}
  8. %%
  9. int yywrap(void){}
  10. void main(int argc, char* argv[]){
  11. /*yyin = fopen(argv[1],"r");*/
  12. yylex();
  13. printf("Line = %d\n",line);
  14. printf("Word = %d\n",word);
  15. printf("Character = %d\n",ch);
  16. }
  17.  
Success #stdin #stdout #stderr 0.02s 7032KB
stdin
Hello there
This is a sample string
stdout
Standard output is empty
stderr
ERROR: /home/YBF1Dw/prog:16:1: 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