%{ int b=0; int t=0; int valid=0; int flag=0; int f=0; int v=0; int o=0; %} /*** Rule Section ***/ %% if|else|while|int|switch|for|char|float|double t++ ; printf("Valid Keywords\n"); ^[a-z A-Z _][a-z A-Z _ 0-9]*$ v++ ; printf("Valid Identifier\n"); ^[/]{1}[/]{1}[a-zA-Z0-9]* b++; printf("Valid Comment"); ^[/]{1}[*]+{1}[a-zA-Z0-9]*[*]{1}[/]{1} b++; printf("Valid Comment"); ^[/]+[a-zA-z]*[0-9]*[/]+ b++; printf("Valid Comment"); ^[0-9]*[.][0-9]+e^[0-9]*[.][0-9]+ valid++; printf("Valid Exponential Number\n"); ^[0-9]+e^[0-9]+ valid++; printf("Valid Exponential Number\n"); ^[0-9]+$ flag++ ;printf("Valid Integer Number\n"); ^[0-9]*[.][0-9]+ f++; printf("Valid Floating point number\n"); ^[+-/*=] o++; printf("Valid Operator \n"); \n {return 0;} %% /*** Code Section ***/ int yywrap(){} int main(){ yylex(); if (f==0 && b==0 && t==0 && valid==0 && flag==0 && v==0 && o==0 ) printf("Invalid \n");