%{
#include <stdio.h>
%}

%%
"int"|"float"|"char"|"if"|"else"|"while"|"for"     { printf("Keyword: %s\n", yytext); }
[0-9]+                                             { printf("Number: %s\n", yytext); }
[a-zA-Z_][a-zA-Z0-9_]*                             { printf("Identifier: %s\n", yytext); }
"=="|"="|"+"|"-"|"*"|"/"|"%"                       { printf("Operator: %s\n", yytext); }
";"|","|"(" | ")" | "{" | "}"                      { printf("Special Symbol: %s\n", yytext); }
[ \t\n]+                                           { /* ignore whitespace */ }
.                                                  { printf("Unknown character: %s\n", yytext); }
%%

int main() {
    printf("Enter your source code (Press CTRL+D or CTRL+Z to end input):\n");
    yylex();
    return 0;
}
