fork download
  1. %{
  2. #include <stdio.h>
  3. int yylex()
  4. int yyerror(char *s)
  5.  
  6. %}
  7. %token ALPHA DIGIT
  8. %%
  9. var:ALPHA
  10. |ALPHA
  11. |DIGIT
  12. ;
  13. %%
  14. int main()
  15. {
  16. printf("enter the name of variables\n");
  17. yyparse();
  18. printf("valid variable");
  19. return 0;
  20. }
  21.  
  22. int yyerror(char *s)
  23. {
  24. printf("invalid variable")
  25. return 1;
  26. }
Success #stdin #stdout #stderr 0.02s 3188KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/run-20086/prog:26:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit