fork download
  1. %{ %}
  2.  
  3. %s ABCDEAD
  4.  
  5. // not accepted state after visiting A %%
  6.  
  7. <INITIAL>a BEGIN A;
  8.  
  9. <INITIAL>b BEGIN INITIAL;
  10.  
  11. <INITIAL>[^ab\n] BEGIN DEAD;
  12.  
  13. <INITIAL>\n BEGIN INITIAL;
  14.  
  15. {printf("Not Accepted\n");}
  16.  
  17. // not accepted state after visiting A and B state
  18.  
  19. <A>a BEGIN A;
  20.  
  21. <A>b BEGIN B;
  22.  
  23. <A>[^ab\n] BEGIN DEAD;
  24.  
  25. <A>\n BEGIN INITIAL; {printf("Not Accepted\n");}
  26.  
  27. // // not accepted state after visiting A and C state
  28.  
  29. <B>a BEGIN A;
  30.  
  31. <B>b BEGIN C;
  32.  
  33. <B>[^ab\n] BEGIN DEAD;
  34.  
  35. <B>\n BEGIN INITIAL; {printf("Not Accepted\n");}
  36.  
  37. // Accepted case
  38.  
  39. <C>a BEGIN A;
  40.  
  41. <C>b BEGIN INITIAL;
  42.  
  43. <C>[^ab\n] BEGIN DEAD;
  44.  
  45. <C>\n BEGIN INITIAL;
  46.  
  47. {printf("Accepted\n"); }
  48.  
  49. // Invalid Case
  50.  
  51. <DEAD>[^\n] BEGIN DEAD;
  52.  
  53. <DEAD>\n BEGIN INITIAL;
  54.  
  55. {printf("Invalid\n");}
  56.  
  57. %%
  58.  
  59. // yywrap method int yywrap()
  60.  
  61. { return 1; }
  62.  
  63. // main method
  64.  
  65. int main()
  66.  
  67. { printf("Enter String\n");
  68.  
  69. // called yylex yylex();
  70.  
  71. return 0;
  72.  
  73. }
Success #stdin #stdout #stderr 0.02s 6872KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/eAAsE6/prog:73:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit