Providing JSP, Servlet, JAVA, JavaScript, HTML, CSS, C#, C++, Python Tutorials
%{
int a=0;
int b=0;
%}
word [a-z]+[ ]
sent [.?!]
%%
{sent} a++,b++;
{word} a++;
%%
void main()
{
printf("Enter the String \n");
yylex();
printf("number of words %d \n",a);
printf("number of sentence %d \n",b);
}
lex even.l
cc lex.yy.c -lfl
./a.out
then press CTRL+d
Posted in: Lex tutorial


0 Comments:
Post a Comment