//Lex program to count the number of identifiers
|
%{#include<iostream.h>
int count=0;
char ch=0;
%}
digit[0-9]
letter[a-zA-Z_]
%%
{letter}({letter}|{digit})* {
count++;
}
%%
int main()
{
yylex();
printf("count: %d",count);
return 0;
}
// Output of the above Program

Lex program to count the number of identifiers
Thanku it is helpful
ReplyDelete