Identifying words of length 4-8 characters long.
%{
#include<stdio.h.>
int a=0;
%}
%%
[a-zA-Z0-9._]+ {a=yyleng; if(a==4||a==5||a==6||a==7||a==8) printf("Word accepted");}
%%
main()
{
yylex();
}
#include<stdio.h.>
int a=0;
%}
%%
[a-zA-Z0-9._]+ {a=yyleng; if(a==4||a==5||a==6||a==7||a==8) printf("Word accepted");}
%%
main()
{
yylex();
}
Comments
Post a Comment