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

// Function prototype for yyerror
void yyerror(const char *s);
int yylex();
int yywrap() { return 1; }
%}

%%
[0-9]+ {
    printf("Number: %s\n", yytext);
    return atoi(yytext);
}
[+\-*/] {
    printf("Operator: %s\n", yytext);
    return yytext[0];
}
\n { return 0; }
[ \t] { /* Ignore whitespace */ }
. { printf("Invalid character: %s\n", yytext); }
%%

int main() {
    printf("Enter an arithmetic expression:\n");
    yylex();
    return 0;
}

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