Program to count the no of comment lines from a given input
c file and store the result in another file without those comment lines.
%{
#include<stdio.h>
int c=0;
%}
%%
[/][/][a-zA-Z0-9]*
{c++;}
[/][*][a-zA-Z0-9][*][/]
{c++;}
%%
main(int
argc,char*argv[ ])
{
yyin=fopen(argv[1],"r");
yyout=fopen(argv[2],"w");
yylex();
printf("no
of clines %d\n",c);
}
%{
ReplyDelete#include
int c=0;
%}
%%
[/][/][a-zA-Z0-9]* {c++;}
[/][*][a-zA-Z0-9][*][/] {c++;}
%%
main(int argc,char*argv[ ])
{
yyin=fopen(argv[1],"r");
yyout=fopen(argv[2],"w");
yylex();
printf("no of clines %d\n",c);
}