fork download
  1. %{
  2. int space=0;
  3. int taab=0;
  4. int nextline=0;
  5. int chara=0;
  6. %}
  7.  
  8. %%
  9. [" "] {space++;}
  10. [\t] {taab++;}
  11. [\n] {nextline++;}
  12. [A-Za-z0-9] {chara++;}
  13. %%
  14.  
  15. int main(){
  16. yylex();
  17. printf("space= %d \n",space);
  18. printf("next line: %d \n",nextline);
  19. printf("Tab: %d \n",taab);
  20. printf("char: %d \n",chara);
  21. }
Success #stdin #stdout #stderr 0.03s 6904KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/p34pNi/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit