fork download
  1. %{
  2. #include "y.tab.h";
  3. %}
  4. %%
  5. [a] return A;
  6. [b] return B;
  7. .return yytext[0];
  8. \n return yytext [0];
  9. %%
  10. %{
  11. #include<stdio.h>
  12. %}
  13. %token a,b
  14. %%
  15. input:expr\n{return 0;}
  16. expr:X;
  17. X=AXB|;
  18. %%
  19. main()
  20. {
  21. printf("enter string\n");
  22. if(!yyparse())
  23. {
  24. Printf ("valid");
  25. exit (0);
  26. }
  27. }
  28. void yyerror (char*s)
  29. {
  30. printf("syntax error")
  31. }
Success #stdin #stdout #stderr 0.02s 6932KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/NDr7GN/prog:31:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit