fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. if |
  7. else |
  8. printf { printf("%s is a keyword",yytext);}
  9. [0-9]+ {printf(%s is a number,yytext);}
  10. .|\n {ECHO;}
  11. %%
  12.  
  13. int main()
  14. {
  15. printf("\n Enter string:");
  16. yylex();
  17. }
  18. int yywrap()
  19. {
  20. return 1;
  21. }
Success #stdin #stdout #stderr 0.02s 6968KB
stdin
if
stdout
Standard output is empty
stderr
ERROR: /home/TqbWJx/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit