Sunday, 16 June 2019

Write a LEX program that reads input file and copies only words starting with vowels to output file.


             

               Code :

%{
#include<stdio.h>
#include<string.h>
%}
alpha [a-zA-Z]
digit [0-9]
space [ \n\t]
start ^(a|e|i|o|u|A|E|I|O|U)
%%
{start}({alpha}|{digit})* {fprintf(yyout,"%s",yytext);}
{space}(a|e|i|o|u|A|E|I|O|U)({alpha}|{digit})*  {fprintf(yyout,"%s",yytext);}
. ;
%%
main()
{
yyin=fopen("in.txt","r");
yyout=fopen("out.txt","w");
yylex();
}
int yywrap()
{
return 1;
}

1 comment:

  1. Las Vegas (casino) - Dr. Maryland
    Find a casino near you, and enjoy the 계룡 출장안마 best of both worlds. 양산 출장샵 Choose 광명 출장마사지 from more than 2,300 slot machines and 안동 출장안마 over 사천 출장마사지 2000 table games.

    ReplyDelete

It's time To increase blogging capability. To have a chance to contribute in digital world. Any Interested People who want to make t...