fork download
  1. %{
  2. int state = 0;
  3. %}
  4. %%
  5. a { state = (state == 0 || state == 2) ? state + 1 : state - 1; }
  6. b { state = (state == 0 || state == 1) ? state + 2 : state - 2; }
  7. \n {
  8. if (state == 1)
  9. printf("Accepted\n");
  10. else
  11. printf("Rejected\n");
  12. state = 0;
  13. }
  14. . ;
  15. %%
  16. int main() {
  17. yylex();
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.03s 6872KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/7QEw2F/prog:19:1: Syntax error: end_of_file_in_quasi_quotation
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit