Lex Program to Identify Comment Lines
Lex Program to Identify both single line and multi line comments using regular expressions in lex
[cc lang=”c”]
%{
#include
%}
%%
[/]{1}[/]{1}[a-zA-Z0-9]* printf(“Single Line Comment”);
[/]{1}[*]{1}[a-zA-Z0-9]*[*]{1}[/]{1} printf(“MultiLine Comment”);
%%
main(){yylex();}
[/cc]
Recent Comments