fork download
  1. %{
  2. #include <stdio.h>
  3. int capital = 0, small = 0;
  4. %}
  5.  
  6. %%
  7. [A-Z][a-zA-Z]* { capital++; }
  8. [a-z][a-zA-Z]* { small++; }
  9. [ \t\n]+ ;
  10. . ;
  11. %%
  12.  
  13. int yywrap() { return 1; }
  14.  
  15. int main() {
  16. printf("Enter text:\n");
  17. yylex();
  18. printf("\nCapital words = %d\n", capital);
  19. printf("Small words = %d\n", small);
  20. return 0;
  21. }
Success #stdin #stdout #stderr 0.03s 6892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/EQvi8U/prog:2:1: Syntax error: Operator expected
ERROR: /home/EQvi8U/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit