fork download
  1. %option noyywrap
  2. %{
  3. #include<stdio.h> %}
  4. %s A B
  5. %%
  6. <INITIAL>1 BEGIN INITIAL;
  7. <INITIAL>0 BEGIN A;
  8. <INITIAL>[^0 ^1 |\n] BEGIN B;
  9. <INITIAL>\n BEGIN INITIAL; printf("Accepted\n");
  10. <A>1 BEGIN A;
  11. <A>0 BEGIN INITIAL;
  12. <A>[^0|\n] BEGIN B;
  13. <A>\n BEGIN INITIAL; printf("Not Accepted\n");
  14. <B>0 BEGIN B;
  15. <B>1 BEGIN B;
  16. <B>[^0|\n] BEGIN B;
  17. <B>\n {BEGIN INITIAL; printf("INVALID\n");}
  18. %%
  19. void main()
  20. { yylex();
  21. }
  22.  
Success #stdin #stdout #stderr 0.03s 6936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/w4H4KY/prog:21:3: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit