fork download
  1. %{
  2. #include <stdio.h>
  3. int v = 0, c = 0; // Counters for vowels and consonants
  4. %}
  5.  
  6. %%
  7.  
  8. [aeiouAEIOU] { v++; } // Increment vowel count
  9. [a-zA-Z] { c++; } // Increment consonant count
  10. \n { return 0; } // Stop reading on newline
  11.  
  12. %%
  13.  
  14. int main() {
  15. printf("Enter input: ");
  16. yylex(); // Process input
  17. printf("VOWELS = %d\nCONSONANTS = %d\n", v, c);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.02s 6984KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/OIjImc/prog:19:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit