fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4.  
  5. %%
  6. "+"|"-"|"*"|"/" { printf("Arithmetic Operator: %s\n", yytext); }
  7. "="|"+="|"-="|"*="|"/="|"%=" { printf("Assignment Operator: %s\n", yytext); }
  8. "&"|"|"|"^"|"~" { printf("Bitwise Operator: %s\n", yytext); }
  9. "=="|"!="|"<"|">"|"<="|">=" { printf("Relational Operator: %s\n", yytext); }
  10. "<<"|">>" { printf("Shift Operator: %s\n", yytext); }
  11. "&&"|"||"|"!" { printf("Logical Operator: %s\n", yytext); }
  12. .|\n { /* Ignore other characters */ }
  13. %%
  14.  
  15. int main() {
  16. yylex();
  17. return 0;
  18. }
  19.  
  20. int yywrap() {
  21. return 1;
  22. }
  23.  
Success #stdin #stdout #stderr 0.04s 6956KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/8R1rkc/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit