Convert Lowercase to Uppercase & Reverse - Lex Progam - Compiler Design

CHANGE CASE - LEX - PROGRAM


Program:

// Lex file: cap.l


lower [a-z]
CAPS  [A-Z]
space    [ \t\n]

%%
{lower}         {printf("%c",yytext[0]- 32);}
{CAPS}        {printf("%c",yytext[0]+ 32);}
{space}        ECHO;
.                    ECHO;
%%

main()
{
    yylex();
   
}

Output:
nn@linuxmint ~ $ lex cap.l
nn@linuxmint ~ $ gcc lex.yy.c -ll
nn@linuxmint ~ $ ./a.out<tst.txt
WWW.2K8618.BLOGSPOT.COM
sanjana    jamsheena chaithanya neethu
GOVINDAPRASAD VIPIN ADARSH SHIVIN
baby brinda kavya helen
SALMAN TINU RICHARD  SIBIN
SHIVIN laji NABEEL
www.2k8cse.cu.cc
nn@linuxmint ~ $

// tst.txt

www.2k8618.blogspot.com
SANJANA    JAMSHEENA CHAITHANYA NEETHU
govindaprasad vipin adarsh shivin
BABY BRINDA KAVYA HELEN
salman tinu richard  sibin
shivin LAJI nabeel
WWW.2K8CSE.CU.CC

21 comments:

  1. lai bhari.......................................;-)

    ReplyDelete
  2. right answer ahe ga porano..

    ReplyDelete
  3. kya lai bhari... x-(

    ReplyDelete
  4. de ga bai pen de

    ReplyDelete
  5. hamara HOD kaisa ho??????

    ReplyDelete
  6. ghe g bai black pen ghe

    ReplyDelete
  7. durgaaaaaaaaaa idhar aooooooo

    ReplyDelete
  8. down arrow press karo ree

    ReplyDelete
  9. kare na reeee........

    ReplyDelete
  10. reply sirf dikhane k liye hi h ya work bhi karta..

    ReplyDelete
  11. how can I change the case of the first letter of my word?

    ReplyDelete
  12. only the first letter not whole string

    ReplyDelete
  13. why cant we give input dierectly ?
    why do we have to supply an extra file from outside for type converstion.
    i need that type of programme

    ReplyDelete
  14. Great content and information. Thanks for sharing and Keep posting. Alternating case converter

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...