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