fork download
  1. %{
  2. int c;
  3. %}
  4. %%
  5. [a-zA-Z]+ {C++;printf("\n'%s' is a word\n",yytext);}
  6. [^a-zA-Z\n]+;
  7. .;
  8. %%
  9. int main(){
  10. printf("Enter a string:\n");
  11. yylex();
  12. printf("The number of words: %d\n",c
  13.  
  14. }
  15. int yywrap()
  16. {
  17. return 1;
  18. }
Success #stdin #stdout #stderr 0.02s 6996KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/LHt22I/prog:18:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit