764 views
0 votes
0 votes
%{
    #include<stdio.h>
    int vowels=0;
    int cons=0;
%}
%%
[aeiouAEIOU] {vowels++;}
[a-zA-Z] {cons++;}
%%
int yywrap()
{

return 1;
}
int main( )
{
 printf("Enter the string..at end press^d\n");
 yylex();
 printf("No of vowels = %d \n No of consonants = %d\n",vowels,cons);
 return 0;
}

when i run this program in ubuntu . iam able to enter the string but it does print the line for counting vowels and consonants

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
2
LavTheRawkstar asked Nov 10, 2016
1,145 views
The difference between a Lex Compiler and a YACC compiler is ?
0 votes
0 votes
1 answer
3
Amit kanodia asked Feb 4
122 views
class A:def_init__(s): self.s=sdef print():passa = A('John')a.print()
0 votes
0 votes
1 answer
4
fxavain asked Feb 11, 2022
312 views
L = {w: w ε{0,1}*,Every substring of four symbols has at most two 0’s}Write a program using c++ or java.The input program is the string to be tested.The automata must ...