fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4. %option noyywrap
  5. %%
  6. "int"|"double"|"float"|"if"|"else"|"while"|"do"{
  7. printf("Keywords:%s\n",yytext);
  8. }
  9. [a-zA-Z_][a-zA-Z0-9_]*{
  10. printf("identifiers:%s\n",yytext);
  11. }
  12. %%
  13. int main(){
  14. yylex();
  15. return 0;
  16. }%{
  17. #include<stdio.h>
  18. %}
  19. %option noyywrap
  20. %%
  21. "int"|"double"|"float"|"if"|"else"|"while"|"do"{
  22. printf("Keywords:%s\n",yytext);
  23. }
  24. [a-zA-Z_][a-zA-Z0-9_]*{
  25. printf("identifiers:%s\n",yytext);
  26. }
  27. %%
  28. int main(){
  29. yylex();
  30. return 0;
  31. }
Success #stdin #stdout #stderr 0.02s 6960KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/GVQemk/prog:31:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit