Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- letter [a-zA-Z]
- digit [0-9]
- %{
- #include <stdio.h>
- %}
- %x comment
- %%
- "/*" {BEGIN(comment); printf("Comment started\n");}
- <comment>[^*]* { }
- <comment>"*"+[^*/]* { }
- <comment>"*"+"/" {BEGIN(INITIAL); printf("Comment Ended\n");}
- {letter}({letter}|{digit})* {printf("identifier scanned: %s\n", yytext);}
- [ \t\n]+ { }
- . { }
- %%
- int yywrap() {
- return 1;
- }
- int main()
- {
- yylex();
- }
Advertisement