fork download
  1. %{
  2. #include<stdio.h>
  3. int single=0;
  4. int multi=0;
  5. %}
  6. %%
  7. "//"([a-z]|[A-Z]|[0-9]|" ")* {++single;}
  8. "/*"(.*\n)* "*/" {++multi;}
  9. %%
  10. int main(int argc, int **argv)
  11. {
  12. yyin=fopen("abc.txt","r");
  13. yylex();
  14. printf("no of single line comment = %d ", single);
  15. printf("no of multi line comment = %d ", multi);
  16. return 0;
  17. }
Success #stdin #stdout #stderr 0.02s 6844KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/FxgZB2/prog:17:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit