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