fork download
  1. %{ #include<stdio.h>
  2. int identifiers = 0;
  3. %}
  4.  
  5. %%
  6. ^[a-zA-Z_][a-zA-Z0-9_]* identifiers++;
  7. %%
  8.  
  9. int yywrap()
  10. {
  11. return 1;
  12. }
  13.  
  14. int main()
  15. {
  16. yyin=fopen("file.txt","r");
  17. yylex();
  18. printf("No. of identifiers: %d\n",identifiers);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.02s 6812KB
stdin
this
is
a
testing
9program
stdout
Standard output is empty
stderr
ERROR: /home/aBmCWh/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Can't ignore goal at this port
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? % Execution Aborted
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit