fork download
  1. %{
  2.  
  3. %}
  4. %s SM SMBG
  5. %%
  6. # BEGIN(SM);
  7. ## BEGIN(SMBG);
  8. [0-9]+ {
  9. printf("\n It's a Digit ");
  10. }
  11. <SMBG>[A-Z]+ { printf("\n String contains upper case letters ");
  12. }
  13. <SM>. {
  14. printf("\n Exiting from # start condition ");
  15. BEGIN(INITIAL);
  16. }
  17. <SM,SMBG>[a-z]+ {
  18. printf("\n String contains lower case letters ");
  19. }
  20. <SMBG>.+ {
  21. printf("\n Exiting from ## start condition ");
  22. }
  23. .+ {
  24. printf("\n No action to execute ");
  25. }
  26.  
  27. %%
  28. void main()
  29. {
  30. yylex();
  31. }
  32. int yywrap()
  33. {
  34. return 1;
  35. }
  36.  
Success #stdin #stdout #stderr 0.02s 6972KB
stdin
122 hello
stdout
Standard output is empty
stderr
ERROR: /home/dOGmRL/prog:35:2: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit