To find number of blank spaces and new lines
%{
#include<stdio.h>
int a=0;
int b=0'
%}
%%
[""] {a++;}
[\n] {b++;}
%%
main()
{
yylex();
printf("No. of spaces: %d",a);
printf("No. of new lines: %d",b);
}
#include<stdio.h>
int a=0;
int b=0'
%}
%%
[""] {a++;}
[\n] {b++;}
%%
main()
{
yylex();
printf("No. of spaces: %d",a);
printf("No. of new lines: %d",b);
}
Comments
Post a Comment