fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4. %%
  5. "+" { printf("PLUS Operator\n"); }
  6. "-" { printf("MINUS Operator\n"); }
  7. "*" { printf("MULTIPLY Operator\n"); }
  8. "/" { printf("DIVIDE Operator\n"); }
  9. [0-9]+ { printf("NUMBER: %s\n", yytext); }
  10. . { printf("UNKNOWN CHARACTER: %s\n", yytext); }
  11. %%
  12. int main() { yylex(); return 0; }
  13. int yywrap() { return 1; }
  14.  
Success #stdin #stdout #stderr 0.03s 6924KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/IUWziO/prog:2:3: Syntax error: Operator expected
ERROR: /home/IUWziO/prog:13:26: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit