%{
#include <stdio.h>
#include <stdlib.h>
%}

%%

// Patterns to recognize
[ \t\n]+               ;  // Ignore whitespace
"int"|"float"|"char"  { printf("Keyword: %s\n", yytext); }
[a-zA-Z_][a-zA-Z0-9_]* { printf("Identifier: %s\n", yytext); }
[0-9]+                { printf("Integer: %s\n", yytext); }
"+"|"-"|"*"|"/"       { printf("Operator: %s\n", yytext); }
"="                   { printf("Assignment: %s\n", yytext); }
"("                   { printf("Delimiter: %s\n", yytext); }
")"                   { printf("Delimiter: %s\n", yytext); }
"{"                   { printf("Delimiter: %s\n", yytext); }
"}"                   { printf("Delimiter: %s\n", yytext); }
"//".*                ;  // Ignore single line comments
"/*".* "*/"           ;  // Ignore multi-line comments
.                     { printf("Unknown: %s\n", yytext); }

%%

// Main function
int main(int argc, char **argv) {
    yylex();
    return 0;
}

// Error handling function
void yyerror(const char *s) {
    fprintf(stderr, "Error: %s\n", s);
}
