90% Discount Hostinger Coupon 1CODERX53
896+ Capstone Project is Available: Whatsapp: +91-7011258995, Email: sharecodepoint@gmail.com

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]; }
%% 

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form