Question: i need help running my lex code. i cant get it to run on my devices and i dont know what is the problem this
i need help running my lex code. i cant get it to run on my devices and i dont know what is the problem
this is my code
%{ #include #include
char temp[]="the"; char longWord[50]; char vwordCount=0;
int numRange [1000]={0}; int num=0; int vCount=0; char vowels[10000][1000]; int count =0; %}
%%
[aeiouAEIOU][a-zA-Z]+ { strcpy(vowels[vCount], yytext); vCount++; }
[0-9]+ { if (atof(yytext) > 70 && atof(yytext) < 50) { numRange[num] = atof(yytext); num = num +1; }// calc the sum of appearences of numbers in range
}//end rule
[a-zA-Z]+ {
if(strcmp(yytext, temp)==0) count++; if ( strlen(yytext) > strlen(longWord)) strcpy(longWord, yytext); } .;
%%
int yywrap() {
return 1; }
int main() {
extern FILE *yyin, *yyout; char text[] = ""; printf("Enter text file name: "); scanf("%s", text); yyin=fopen(text, "r"); yylex();
printf(" The longest word in the file is %s", longWord);
printf(" There number of times %d \"The\"appeard in the file is : ", count);
printf("The count of numbers in the given range : "); int i; for (i = 0; i < num; i++) { printf("%d, ", numRange[i]); }
printf(" There are %d words that start with vowel letter. They are: ", vCount); int k; for (k = 0; k < vCount; k++ ) { printf("/n %s, ", vowels[i]); }
return 0; }
this is the file i want the code to read
This generational and chronological list of Intel processors attempts to present all of Intels processors from the pioneering 4-bit 4004(1971) to the present highend offerings, which include the 64-bit Itanium 2 (2002), Intel Core i7, and Xeon E3 and E5 series processors (2015). Concise technical data are given for each product.
the output shlould be something like this but i just cant get it to run
The longest word is chronological There are 11 words that start with vowel letter.
They are: and, of, Intel, attempts, all, offerings, include, Itanium, and are, each
The numbers that are between 50 and 70 are: 64
There are 3 the mentioned
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
