Identifying single line and multi line comments.
%{
#include<stdio.h>
%}
%%
['//]+{2} [a-zA-Z0-9]+ {printf("single line comment");}
[/][*][a-zA-Z0-9]+[*][/] {printf("multi line comment");}
%%
main()
{
yylex();
}
#include<stdio.h>
%}
%%
['//]+{2} [a-zA-Z0-9]+ {printf("single line comment");}
[/][*][a-zA-Z0-9]+[*][/] {printf("multi line comment");}
%%
main()
{
yylex();
}
Comments
Post a Comment