fork download
  1. %{
  2. #include<stdio.h>
  3. #include <string.h>
  4. #include "lex.yy.c" // Include generated lexer file
  5. int vc=0,cc=0;
  6.  
  7. %}
  8.  
  9. %%
  10. [aeiou] {vc++;}
  11. [a-z] {cc++;}
  12. %%
  13.  
  14. int main()
  15. {
  16. char input[] = "hello world";
  17.  
  18. // Provide the input string to the lexer
  19. yy_scan_string(input);
  20. yylex();
  21. printf("%d %d",vc,cc);
  22. }
  23. int yywrap()
  24. {
  25. return 1;
  26. }
  27.  
Success #stdin #stdout #stderr 0.02s 6872KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/x7sOBG/prog:26:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit