fork download
  1. {
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. int nb = 0;
  5. int mot = 0;
  6. int pen = 0;
  7. %}
  8.  
  9. %option noyywrap
  10.  
  11. chiffre [0-9]
  12. mot [a-zA-Z]+
  13. punctuation [,:!;]
  14.  
  15. %%
  16. {mot} { mot++; }
  17. {punctuation}+ { pen++; }
  18. {chiffre}+(""{chiffre}+)*(","{chiffre}+)? { nb++; }
  19.  
  20. %%
  21.  
  22. int main()
  23. {
  24. yylex();
  25. printf("Il y a %d mots\n", mot);
  26. printf("Il y a %d nombres\n", nb);
  27. printf("Il y a %d ponctuations\n", pen);
  28. return 0;
  29. }
Success #stdin #stdout #stderr 0.02s 6920KB
stdin
55 555,9 kllflf , § 
stdout
Standard output is empty
stderr
ERROR: /home/3H49Fu/prog:29:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit