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("Logical Operator: %s\n", yytext); }
  10. "=="|"!="|"<"|"<="|">"|">=" { printf("Relational Operator: %s\n", yytext); }
  11. "<<"|">>" { printf("Shift Operator: %s\n", yytext); }
  12. .|\n { ; }
  13. %%
  14.  
  15. int main() {
  16. printf("Enter: ");
  17. yylex();
  18.  
  19. }
  20. int yywrap(){
  21. return 1;
  22. }
  23. }
Success #stdin #stdout #stderr 0.02s 6996KB
stdin
+
stdout
Standard output is empty
stderr
ERROR: /home/sKybw2/prog:23:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit