fork download
  1. %{
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. void yyerror(const char *s);
  5. }%
  6.  
  7. %token DIGIT INVALID
  8.  
  9. %%
  10. start : DIGIT { printf("Valid input\n"); }
  11. | INVALID { printf("Invalid input\n"); }
  12. ;
  13.  
  14. %%
  15.  
  16. int main() {
  17. yyparse();
  18. return 0;
  19. }
  20.  
  21. void yyerror(const char *s) {
  22. printf("Syntax Error: %s\n", s);
  23. }
Success #stdin #stdout #stderr 0.02s 6928KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/S7Jg34/prog:23:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit