Aim :- Write a Lex program to count number of vowels and constants in a given input string.
C Program Code :
%{
int v=0,co=0,n=0;
%}
%%
[aeiou] v++;
[0-9] co++;
n++;
%%
int main()
{
FILE *f;
char file[10];
printf("Enter File Name : ");
scanf("%s",file);
f=fopen(file,"r");
yyin=f;
yylex();
printf("\nNumber of Vowels : %d",v);
printf("\nNumber of Constants : %d",co);
return 0;
}
int yywrap()
{
return 1;
}
3 Comments
YinimAcons-fuOlathe Nathan White https://wakelet.com/wake/pASynFLxlrnCx1TJtNUxR
ReplyDeletediaperreno
frususconcme Mike Anderson Software
ReplyDeleteFastStone Capture
Reg Organizer
fectpaddrahi
glycatKenpu Carol Collins Software
ReplyDeleteThere
tadartestda