i have written a lex program ( .l file ) for line count and character count PROGRAM:
%{
int charcount=0,linecount=0;
%}
%%
.charcount++
\n linecount++,charcount++;
%%
main()
{
yylex();
printf(“lines %d”,linecount);
printf(“characters %d”,charcount);
}
int yywrap()
{
return 1;
}
i use flex bison and codeblocks after writing the program i executed it with the command flex lccc.l (lccc is the file name) now i have lex.yy.c file please tell me how do i get the output compiling lex.yy.c is igivng and error.. but this program works fine on linux which is at my college, at home i use the above mentioned tweaks on windows.. please help!
this is the error :
J:\> gcc lex.yy.c
lccc.l: In function 'main':
lccc.l:13: error: stray'\223' in program
lccc.l:13: error: 'lines' undeclared (first use in this function )
lccc.l:13: error: (Each undeclared identifier is reported only once
lccc.l:13: error: for each function it appears in. )
lccc.l:13: error: stray'\224' in program
lccc.l:13: error: 'd' undeclared (first use in this function )
lccc.l:14: error: stray'\223' in program
lccc.l:14: error: 'characters' undeclared (first use in this function )
lccc.l:14: error: stray'\224' in program