Program:
// lex file: vw.l
%{
int count=0;
%}
%%
[aeiouAEIOU] {count++;ECHO;}
%%
main()
{
yylex();
printf("\nNumber of vowels= %d\n",count);
return 0;
}
Output:
nn@linuxmint ~ $ lex vw.l
nn@linuxmint ~ $ gcc lex.yy.c -ll
nn@linuxmint ~ $ ./a.out<vw.txt
www.2k8618.blogspot.com
www.2k8cs.tk
www.google.com
www.gmail.com
Number of vowels= 10
nn@linuxmint ~ $
// lex file: vw.l
%{
int count=0;
%}
%%
[aeiouAEIOU] {count++;ECHO;}
%%
main()
{
yylex();
printf("\nNumber of vowels= %d\n",count);
return 0;
}
Output:
nn@linuxmint ~ $ lex vw.l
nn@linuxmint ~ $ gcc lex.yy.c -ll
nn@linuxmint ~ $ ./a.out<vw.txt
www.2k8618.blogspot.com
www.2k8cs.tk
www.google.com
www.gmail.com
Number of vowels= 10
nn@linuxmint ~ $
This comment has been removed by the author.
ReplyDeletePlzz provide its alorithm
ReplyDelete