%%writefile program.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token DIGIT LETTER UND NL
%%
stmt
: variable
NL {printf
("Valid Identifier\n"
);exit
(0);}variable: LETTER alphanumeric;
alphanumeric: LETTER alphanumeric
| DIGIT alphanumeric
| UND alphanumeric
| LETTER
| DIGIT
| UND;
%%
int yyerror(){
printf("Invalid Identifier\n");
exit(0);
}
void main(){
printf("Enter the variable name: ");
yyparse();
}
JSV3cml0ZWZpbGUgcHJvZ3JhbS55CgolewogICAgI2luY2x1ZGU8c3RkaW8uaD4KICAgICNpbmNsdWRlPHN0ZGxpYi5oPgolfQoldG9rZW4gRElHSVQgTEVUVEVSIFVORCBOTAolJQpzdG10OiB2YXJpYWJsZSBOTCB7cHJpbnRmKCJWYWxpZCBJZGVudGlmaWVyXG4iKTtleGl0KDApO30KdmFyaWFibGU6IExFVFRFUiBhbHBoYW51bWVyaWM7CmFscGhhbnVtZXJpYzogTEVUVEVSIGFscGhhbnVtZXJpYwogICAgICAgICAgICB8IERJR0lUIGFscGhhbnVtZXJpYwogICAgICAgICAgICB8IFVORCBhbHBoYW51bWVyaWMKICAgICAgICAgICAgfCBMRVRURVIKICAgICAgICAgICAgfCBESUdJVAogICAgICAgICAgICB8IFVORDsKJSUKCmludCB5eWVycm9yKCl7CiAgICBwcmludGYoIkludmFsaWQgSWRlbnRpZmllclxuIik7CiAgICBleGl0KDApOwp9Cgp2b2lkIG1haW4oKXsKICAgIHByaW50ZigiRW50ZXIgdGhlIHZhcmlhYmxlIG5hbWU6ICIpOwogICAgeXlwYXJzZSgpOwp9