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