Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Now You can search anything in sharecodepoint using your voice. Click on mic button. Sharecodepoint Youtube Channel

Hi All, Please give your feedback on google. Your Feedback is Important to Us Write Feedback





Sharecodepoint popular queries

Saturday, 23 February 2019

Program to recognize the grammar (an b, n>=10) - Yacc Programs - Compiler Design Lab Programs


Yacc Part :

%token A B NL
%%
stmt : A A A A A A A A A A s B NL
 {
 Printf(“Valid”); exit(0);
 }
 ;
s : s A
 |
 ;
int yyerror(char *msg)
{
 printf(“Invalid String\n”);
 exit(0);
}
main ()
{
 printf(“Enter the String\n”);
 yyparse();
}

Lex Part :

%{
 #include “y.tab.h”
%}
%%
[aA] { return A; }
[bB] { return B; }
\n { return NL ;}
. { return yytext[0]; }
%% 

0 comments:

Post a Comment

 

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