Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

fix the code: #include #include #include #include void main() { FILE fi,fo,fop,fk; int flag=0,i=1; char c,t,a[15],ch[15],file[20]; clrscr(); printf( Enter the File Name:); scanf(%s,&file); fi=fopen(file,r); fo=fopen(inter.c,w);

fix the code: #include #include #include #include void main() { FILE fi,fo,fop,fk; int flag=0,i=1; char c,t,a[15],ch[15],file[20]; clrscr(); printf(" Enter the File Name:"); scanf("%s",&file); fi=fopen(file,"r"); fo=fopen("inter.c","w"); fop=fopen("oper.c","r"); fk=fopen("key.c","r"); c=getc(fi); while(!feof(fi)) { if(isalpha(c)isdigit(c)(c=='['c==']'c=='.'==1)) fputc(c,fo); else { if(c==' ') fprintf(fo,"\t$\t"); else fprintf(fo,"\t%c\t",c); } c=getc(fi); } fclose(fi); fclose(fo); fi=fopen("inter.c","r"); printf(" Lexical Analysis"); fscanf(fi,"%s",a); printf(" Line: %d ",i++); while(!feof(fi)) { if(strcmp(a,"$")==0) { printf(" Line: %d ",i++); fscanf(fi,"%s",a); } fscanf(fop,"%s",ch); while(!feof(fop)) { if(strcmp(ch,a)==0) { fscanf(fop,"%s",ch); printf("\t\t%s\t:\t%s ",a,ch); flag=1; } fscanf(fop,"%s",ch); } rewind(fop); fscanf(fk,"%s",ch); while(!feof(fk)) { if(strcmp(ch,a)==0) { fscanf(fk,"%k",ch); printf("\t\t%s\t:\tKeyword ",a); flag=1; } fscanf(fk,"%s",ch); } rewind(fk); if(flag==0) { if(isdigit(a[0])) printf("\t\t%s\t:\tConstant ",a); else printf("\t\t%s\t:\tIdentifier ",a); } flag=0; fscanf(fi,"%s",a); } getch(); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students explore these related Databases questions

Question

How does selection differ from recruitment ?

Answered: 3 weeks ago

Question

=+What sanctions are available to employers

Answered: 3 weeks ago