fork download
  1. // Write a lex program which replace CSPIT (in any combination) with MBICT.Print out string on screen where case of MBIOCT matches with CSPIT
  2. %{
  3. #include<string.h>
  4. #include<stdio.h>
  5. }%
  6.  
  7. option no yywrap
  8.  
  9. %%
  10.  
  11. [Cc][Ss][Pp][Ii][Tt] {
  12.  
  13. printf("MBICT");
  14.  
  15. }
  16.  
  17. . {
  18. putchar(yytext[0]);
  19. }
  20.  
  21. \n {
  22. putchar('\n');
  23. }
  24.  
  25. %%
  26.  
  27. int main() {
  28. printf("Enter Text");
  29. yylex();
  30. return 0;
  31. }
  32.  
  33. int yywrap() {
  34. return 1;
  35. }
  36.  
Success #stdin #stdout #stderr 0.03s 6956KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/aHdN5f/prog:1:4: Syntax error: Operator expected
ERROR: /home/aHdN5f/prog:35:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit