fork download
  1. %{
  2. #include <stdio.h>
  3. int i;
  4. %}
  5. %%
  6. [a-zA-Z]+ {
  7. for(i = 0; i < yyleng - 2; i++) {
  8. if(yytext[i] == 'a' && yytext[i+1] == 'b' && yytext[i+2] == 'c') {
  9. yytext[i] = 'A';
  10. yytext[i+1] = 'B';
  11. yytext[i+2] = 'C';
  12. }}
  13. printf("%s", yytext);
  14. }
  15. .* { ECHO; }
  16. \n { printf("\n"); exit(0); }
  17. %%
  18. int main() {
  19. printf("Enter a string: ");
  20. yylex();
  21. return 0;
  22. }
  23. int yywrap() {
  24. return 1;
  25. }
  26.  
Success #stdin #stdout #stderr 0.02s 6924KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/7UfUx4/prog:25:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit