fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. [a|b]*abab[a|b]* { printf("Valid: Contains 'abab'\n"); }
  8. [a|b]+ { printf("Invalid: Does not contain 'abab'\n"); }
  9. .|\n { /* Ignore other input */ }
  10.  
  11. %%
  12.  
  13. int main(int argc, char **argv)
  14. {
  15. printf("Enter a string of 'a' and 'b':\n");
  16. yylex();
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.04s 6868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/R1aChi/prog:18:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit