Question: i need help in my lex code. i dont know how to fix the errors , this is the code %{ #include #include char vList[1000];

i need help in my lex code.

i dont know how to fix the errors , this is the code

%{ #include #include

char vList[1000]; int numCount =0 , theCount =0 , arrCount=0, vCount;

char word [] = "the"; char longestWord[] = ".";

%}

%%

[a-zA-Z]+ { if(strcmp(yytext, word)==0) theCount++;

if ( strlen(yytext) > strlen(longestWord)) strcpy(longestWord, yytext); }

[aeiouAEIOU][a-zA-Z]+ { strcpy(vList[vCount],yytext); vCount++;

}

[0-9]+ { if(atof(yytext)>50 && atof(yytext)<70){

numCount++;

} }//end rule

. ;

%%

int yywrap() { }

int main() {

extern FILE *yyin, yyout; char name[] = "" printf(" Enter file location ending with .txt"); scanf("%s", &name); yyin=fopen(name, "r"); yylex();

if(numCount>0) printf("count of numbers in the range of 50-70 is %d", numCount); if(numCount==0) printf(" there was no numbers in the range og 50-70");

printf(" longest words in the text file is %s",longestWord);

printf(" the word starting with vowels are :"); for(int i = 0 ; i

printf(" the count of words starting with vowels is: %d",vCount);

if(theCount>0) printf("the count of word (The) in the text file is : %d", theCount); if(theCount==0) printf(" (the) was not fount in this file");

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!