fork download
  1. %{
  2. #include<stdio.h>
  3. int cnt = 0;
  4. %}
  5. %%
  6. [aA] {cnt++;}
  7. [\n] {/* ignore new line */}
  8. . {/* ignore all other characters */}
  9. %%
  10. int yywrap() {
  11. return 1;
  12. }
  13. int main() {
  14. printf("Enter text : ");
  15. yylex();
  16. printf("Number of a or A : %d\n",cnt);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.02s 6956KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/WWbImf/prog:2:1: Syntax error: Operator expected
ERROR: /home/WWbImf/prog:18:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit