fork download
  1.  
  2. /*lex program to count number of words*/
  3. %{
  4. #include<stdio.h>
  5. #include<string.h>
  6. int i = 0;
  7. %}
  8.  
  9. /* Rules Section*/
  10. %%
  11. ([a-zA-Z0-9])* {i++;} /* Rule for counting
  12.   number of words*/
  13.  
  14. "\n" {printf("%d\n", i); i = 0;}
  15. %%
  16.  
  17. int yywrap(void){}
  18.  
  19. void main()
  20. {
  21. yylex();
  22. }
  23.  
Success #stdin #stdout #stderr 0.02s 6836KB
stdin
Hello Everyone
stdout
Standard output is empty
stderr
ERROR: /home/ZmeQ1F/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit