%{
#include <stdio.h>
#include <stdlib.h>
void yyerror(const char *s);
int yylex(void);
%}
%%
[0-9]+ { printf
("
NUMBER: %s\n", yytext); } [a-zA-Z_][a-zA-Z_0-9]* { printf("IDENTIFIER: %s\n", yytext); }
"+"|"-"|"*"|"/" { printf("OPERATOR: %s\n", yytext); }
\n { /* Ignore newlines */ }
[ \t] { /* Ignore whitespace */ }
. { printf("UNKNOWN: %s\n", yytext); }
%%
int main(void) {
yylex();
return 0;
}
void yyerror(const char *s) {
fprintf(stderr, "Error: %s\n", s);
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnZvaWQgeXllcnJvcihjb25zdCBjaGFyICpzKTsKaW50IHl5bGV4KHZvaWQpOwolfQoKJSUKClswLTldKyAgICAgIHsgcHJpbnRmKCJOVU1CRVI6ICVzXG4iLCB5eXRleHQpOyB9ClthLXpBLVpfXVthLXpBLVpfMC05XSogeyBwcmludGYoIklERU5USUZJRVI6ICVzXG4iLCB5eXRleHQpOyB9CiIrInwiLSJ8IioifCIvIiB7IHByaW50ZigiT1BFUkFUT1I6ICVzXG4iLCB5eXRleHQpOyB9ClxuICAgICAgICAgIHsgLyogSWdub3JlIG5ld2xpbmVzICovIH0KWyBcdF0gICAgICAgIHsgLyogSWdub3JlIHdoaXRlc3BhY2UgKi8gfQouICAgICAgICAgICAgeyBwcmludGYoIlVOS05PV046ICVzXG4iLCB5eXRleHQpOyB9CgolJQoKaW50IG1haW4odm9pZCkgewogICAgeXlsZXgoKTsKICAgIHJldHVybiAwOwp9Cgp2b2lkIHl5ZXJyb3IoY29uc3QgY2hhciAqcykgewogICAgZnByaW50ZihzdGRlcnIsICJFcnJvcjogJXNcbiIsIHMpOwp9Cg==