%{
#include <stdio.h>
%}
/* Token Definitions */
KEYWORD int
|float|if
|else
|while
|return
|void
|char
IDENTIFIER [a-zA-Z_][a-zA-Z0-9_]*
OPERATOR [+\-*/=<>]
DELIMITER [;,(){}]
%%
"//".* { /* Ignore single-line comments */ }
"/*"([^*]|\*+[^/])*\*+/ { /* Ignore multi-line comments */ }
[ \t\n]+ { /* Ignore whitespace */ }
{KEYWORD} { printf("KEYWORD: %s\n", yytext); }
{IDENTIFIER} { printf("IDENTIFIER: %s\n", yytext); }
{OPERATOR} { printf("OPERATOR: %s\n", yytext); }
{DELIMITER} { printf("DELIMITER: %s\n", yytext); }
. { printf("UNKNOWN: %s\n", yytext); }
%%
int main() {
yylex();
return 0;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiV9CgovKiBUb2tlbiBEZWZpbml0aW9ucyAqLwpLRVlXT1JEICAgICAgaW50fGZsb2F0fGlmfGVsc2V8d2hpbGV8cmV0dXJufHZvaWR8Y2hhcgpJREVOVElGSUVSICAgW2EtekEtWl9dW2EtekEtWjAtOV9dKgpOVU1CRVIgICAgICAgWzAtOV0rKFwuWzAtOV0rKT8KT1BFUkFUT1IgICAgIFsrXC0qLz08Pl0KREVMSU1JVEVSICAgIFs7LCgpe31dCgolJQoiLy8iLiogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IC8qIElnbm9yZSBzaW5nbGUtbGluZSBjb21tZW50cyAqLyB9CiIvKiIoW14qXXxcKitbXi9dKSpcKisvICAgICAgICAgICAgIHsgLyogSWdub3JlIG11bHRpLWxpbmUgY29tbWVudHMgKi8gfQpbIFx0XG5dKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IC8qIElnbm9yZSB3aGl0ZXNwYWNlICovIH0Ke0tFWVdPUkR9ICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBwcmludGYoIktFWVdPUkQ6ICVzXG4iLCB5eXRleHQpOyB9CntJREVOVElGSUVSfSAgICAgICAgICAgICAgICAgICAgICAgIHsgcHJpbnRmKCJJREVOVElGSUVSOiAlc1xuIiwgeXl0ZXh0KTsgfQp7TlVNQkVSfSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHByaW50ZigiTlVNQkVSOiAlc1xuIiwgeXl0ZXh0KTsgfQp7T1BFUkFUT1J9ICAgICAgICAgICAgICAgICAgICAgICAgICB7IHByaW50ZigiT1BFUkFUT1I6ICVzXG4iLCB5eXRleHQpOyB9CntERUxJTUlURVJ9ICAgICAgICAgICAgICAgICAgICAgICAgIHsgcHJpbnRmKCJERUxJTUlURVI6ICVzXG4iLCB5eXRleHQpOyB9Ci4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgcHJpbnRmKCJVTktOT1dOOiAlc1xuIiwgeXl0ZXh0KTsgfQolJQoKaW50IG1haW4oKSB7CiAgICB5eWxleCgpOwogICAgcmV0dXJuIDA7Cn0K