fork download
  1. %{
  2. #include<stdio.h>
  3. int tabs=0,spaces=0,newline=0,character=0;
  4. %}
  5. %%
  6. [\t] tabs++;
  7. [" "] spaces++;
  8. [\n] newline++;
  9. [^\n\t" "] character++;
  10. %%
  11. int yywrap(){
  12. return 1;
  13. }
  14. int main(){
  15. printf("Enter here\n");
  16. yylex();
  17. printf("Tabs::%d\n",tabs);
  18. printf("Spaces::%d\n",spaces);
  19. printf("Characters::%d\nLines::%d\n",character,newline);
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6988KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/uBs0j3/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit