Using your phone's internet browser
go to:  qna.rediff.com
Click and drag this link to
the Home icon in your browser.
Q.

Write a lex program to count the number of comment lines in a given C program .Also eliminate them and copy that program into seperate file

About: LEX programs for III sem MCA

29 Nov '08 07:43 pm
  Invite a friend  |  
  Save  |  
 Earn 10 points for answering
Answer this question  Earn 10 points for answering    
4000 characters remaining  
  
    
Keep me signed inNew User? Sign up

Answers (1)

1.

%{
#include
int comments=0;
%]

%%
"//".* {comments++;}
"/*"[a-zA-Z0-9n]*"*/" {comments++;}
%%
...more
Answered by RAVIMOHAN KAIVAR, 13 Sep '09 10:01 pm

 
  
Report abuse
Useful
 (0)
Not Useful
 (0)
Your vote on this answer has already been received

Ask a Question

Get answers from the community

600 characters remaining