PCD
PR3A
%{
#include<stdio.h>
%}
%%
"ycce"
{printf("YCCE");}
"it"
{printf("IT");}
%%
main()
{
extern FILE
*yyin;
yyin=fopen("input.txt","r");
yylex();
}
int
yywrap()
{
return (1);
input.txt
hello ycce and it branch
PR3B
input.txt
%{
#include<stdio.h>
int
count1=0, count2=0;
%}
%%
"ycce"
{count1++; printf("YCCE");}
"it"
{count2++; printf("IT");}
%%
main()
{
extern FILE
*yyin;
yyin=fopen("input.txt","r");
yylex();
printf("This
file contain %d times YCCE and %d times IT", count1, count2);
}
int
yywrap()
{
return (1);
input.txt
hello YCCE
and IT branch YCCE is my love i love
YCCE
Comments
Post a Comment