fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. [0-9]+ { printf("NUMBER: %s\n", yytext); }
  8. [a-zA-Z][a-zA-Z0-9]* { printf("IDENTIFIER: %s\n", yytext); }
  9. "+" { printf("OPERATOR: %s\n", yytext); }
  10. "-" { printf("OPERATOR: %s\n", yytext); }
  11. "*" { printf("OPERATOR: %s\n", yytext); }
  12. "/" { printf("OPERATOR: %s\n", yytext); }
  13. "=" { printf("OPERATOR: %s\n", yytext); }
  14. ";" { printf("SPECIAL SYMBOL: %s\n", yytext); }
  15. [ \t\n] ;
  16.  
  17. %%
  18. int main() {
  19. yylex();
  20. return 0;
  21.  
Success #stdin #stdout #stderr 0.02s 6916KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/ggZxIU/prog:20:13: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit