fork download
  1. %{
  2. #include <stdio.h>
  3. int vowels = 0, consonants = 0, digits = 0;
  4. %}
  5.  
  6. %%
  7. [aeiouAEIOU] { vowels++; }
  8. [a-zA-Z] { consonants++; }
  9. [0-9] { digits++; }
  10. %%
  11.  
  12. int main() {
  13. printf("Enter a string: ");
  14. yylex();
  15. printf("Vowels: %d\nConsonants: %d\nDigits: %d\n", vowels, consonants, digits);
  16. return 0;
  17. }
  18.  
  19. int yywrap() {
  20. return 1;
  21. }
Success #stdin #stdout #stderr 0.03s 6908KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/tQ4c1I/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit