Laboratory Assignment Sheet
1. Write a program in Lex to identify whether letter is consonant or vowel.
Code:
%option noyywrap
%{
#include<stdio.h>
%}
%%
["a"|"e"|"i"|"o"|"u"|"A"|"E"|"I"|"O"|"U" ] {printf(" vowel");}
[a-z|A-Z] {printf(" consonent");}
%%
int main()
{
printf("Enter Word: ");
yylex();
return 0;
}
Output: