Lex Program to Identify Strings without Substring bb
This is the lex program to accept class of strings without having the substring bb
Lex Program:
%{
#include<stdio.h>
#include "y.tab.h"
%}
%%
[a-zA-Z0-9]*[b]{2,2}[a-zA-Z0-9]* return VL;
[a-zA-Z0-9]* return ER;
%%
YACC Program:
%{
#include<stdio.h>
%}
%token VL ER
%%
start:VL {printf("Error");}
%%
void yyerror(const char *str){printf("Valid");}
int yywrap(){return 1;}
main(){yyparse();}
Recent Comments