fork download
  1. %{
  2. #include<stdio.h>
  3. char convert(char c){
  4. if(c >= 'a' && c <= 'z'){
  5. c = c - 32;
  6. } else (c >= 'A' && c <= 'Z'){
  7. c = c + 32;
  8. }
  9. return c;
  10. }
  11.  
  12. %}
  13.  
  14. %%
  15. [a-zA-Z] {putchar(convert(yytext[0]));}
  16. . {putchar(yytext[0]);}
  17. %%
  18.  
  19. int yywrap()
  20. {
  21. return 1;
  22. }
  23.  
  24. int main()
  25. {
  26. printf("Enter a word: ");
  27. yylex();
  28. return 0;
  29. }
Success #stdin #stdout #stderr 0.03s 6892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/7rx3Hs/prog:2:1: Syntax error: Operator expected
ERROR: /home/7rx3Hs/prog:29:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit