
%{
#include<stdio.h>
%}

%%
"bool"|"int"|"float"|"char"|"if"|"else"|"while"|"for"|"do"|"continue"|"break"|"return"|"void"
                { printf("Keyword\n"); }

\/\/[^\n]*      { /* Ignore single line comment */ }

\/\*([^*]|\*+[^*/])*\*+\/
                { /* Ignore multi line comment */ }

[ \t\n]+        { /* Ignore spaces, tabs and newlines */ }

[0-9]+(\.[0-9]+)?
                { printf("Constant\n"); }

[A-Za-z_][A-Za-z0-9_]*
                { printf("Identifier\n"); }

"=="|"!="|"<="|">="|"++"|"--"|"&&"|"||"|[+\-*/%=<>!]
                { printf("Operator\n"); }

[(){};,]        { /* Ignore punctuation */ }

.               { /* Ignore other characters */ }

%%

int main()
{
    printf("Enter the input:\n");
    yylex();
    return 0;
}
