Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Your Ads Here Sharecodepoint Youtube Channel



Sharecodepoint popular queries

Saturday, 23 February 2019

Program to recognize whether a given sentence is simple or compound. | Compiler Design Lab Programs | Lex Programs


Compiler Design Lab Program :

%{
 #include<stdio.h>
 Int is_simple=1;
%}
%%
[ \t\n]+[aA][nN][dD][ \t\n]+ {is_simple=0;}
[ \t\n]+[oO][rR][ \t\n]+ {is_simple=0;}
[ \t\n]+[bB][uU][tT][ \t\n]+ {is_simple=0;}
. {;}
%%
int yywrap()
{
return 1;
}
main()
{
 int k;
 printf(“Enter the sentence.. at end press ^d”);
 yylex();
if(is_simple==1)
 {
 Printf(“The given sentence is simple”);
 }
else
 {
 Printf(“The given sentence is compound”);
 }
}

0 comments:

Post a Comment

 

Version 23.2.3.4 - 2016 - 2019 - © Sharecodepoint | Made in India. | Copyright Content