10-08-2011, 11:44 AM
Code:
Algorithm:-
begin
if string=[0-9]*000[0-9]*
then
printf “Algorithm:-
string accepted”
else
printf “string rejected”
end
Program:-
LEX program to recognize a string with three consecutive 0’s
%%
[0-9]*000[0-9]* { printf(“string accepted”);}
[0-9]* { printf(“string rejected”);}
%%
main()
{
yylex();
}\
int yywrap()
{
return 1;
}