fork download
  1. %{
  2. #include <stdio.h>
  3. #include "y.tab.h" // If used with yacc/bison, needed for token definitions
  4. %}
  5.  
  6. %%
  7.  
  8. "i" { return ID; }
  9. "+" { return PLUS; }
  10. "*" { return MUL; }
  11. "(" { return LPAREN; }
  12. ")" { return RPAREN; }
  13. [ \t\n]+ { /* skip whitespace */ }
  14. . { printf("Invalid character: %s\n", yytext); }
  15.  
  16. %%
  17.  
  18. int yywrap() {
  19. return 1;
  20. }
Success #stdin #stdout #stderr 0.03s 6956KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/vs1vTf/prog:2:1: Syntax error: Operator expected
ERROR: /home/vs1vTf/prog:20:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit