%{
#include <stdio.h>
a = 10 + 20;
%}
%%
[0-9]+ { printf
("
NUMBER: %s\n", yytext); } [a-zA-Z_][a-zA-Z0-9_]* { printf("IDENTIFIER: %s\n", yytext); }
[+\-*/] { printf("OPERATOR: %s\n", yytext); }
[\t\n\r ]+ { /* Ignore whitespace */ }
. { printf("UNKNOWN CHARACTER: %s\n", yytext); }
%%
int main() {
yylex(); // Calls the lexical analyzer
return 0;
}
int yywrap() {
return 1; // Indicates end of input
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CmEgPSAxMCArIDIwOwolfQoKJSUKClswLTldKyAgICAgICAgICAgIHsgcHJpbnRmKCJOVU1CRVI6ICVzXG4iLCB5eXRleHQpOyB9ClthLXpBLVpfXVthLXpBLVowLTlfXSogICB7IHByaW50ZigiSURFTlRJRklFUjogJXNcbiIsIHl5dGV4dCk7IH0KWytcLSovXSAgICAgICAgICAgeyBwcmludGYoIk9QRVJBVE9SOiAlc1xuIiwgeXl0ZXh0KTsgfQpbXHRcblxyIF0rICAgICAgICB7IC8qIElnbm9yZSB3aGl0ZXNwYWNlICovIH0KLiAgICAgICAgICAgICAgICAgeyBwcmludGYoIlVOS05PV04gQ0hBUkFDVEVSOiAlc1xuIiwgeXl0ZXh0KTsgfQoKJSUKCmludCBtYWluKCkgewogICAgeXlsZXgoKTsgIC8vIENhbGxzIHRoZSBsZXhpY2FsIGFuYWx5emVyCiAgICByZXR1cm4gMDsKfQoKaW50IHl5d3JhcCgpIHsKICAgIHJldHVybiAxOyAgLy8gSW5kaWNhdGVzIGVuZCBvZiBpbnB1dAp9Cg==