fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4. letter [a-zA-Z]
  5. digit [0-9]
  6. %%
  7. int|char|double|void|main {printf("Keyword");}
  8. [a-z A-Z] {printf("Identifier");}
  9. [0-9]* {printf("Identifier");}
  10. Integer|Float {printf("Data Type");}
  11. digit {printf("Constant");}
  12. "+"|"-"|"="|"/"|"*"|"%"|"^"|"<"|">" {printf("Relational Operator");}
  13. %%
  14. int yywrap(void)
  15. {
  16. return 1;
  17. }
  18. int main()
  19. {
  20. yylex();
  21. return 0;
  22. }
Success #stdin #stdout #stderr 0.04s 6840KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/mkmeXs/prog:22:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit