YACC Program to Implement a^nb
This is the YACC Program to Implement a program that accepts string of form a^nb where n>=1 ie..aaab or aaaaab or ab.it cannot have two or more than one b’s at the end
Lex: Program
%{
#include<stdio.h>
%}
%token A CO ZA ER ERR
%%
start:CO {printf("Valid declaration");}
%%
void yyerror(const char *str){printf("error");}
int yywrap(){return 0;}
main()
{yyparse();}
YACC Program:
%{
#include<stdio.h>
%}
%token A CO ZA ER ERR
%%
start:CO {printf("VAlid declaration");}
%%
void yyerror(const char *str){printf("error");}
int yywrap(){return 0;}
main()
{yyparse();}
Recent Comments