Language Processor
Wednesday, July 27, 2011
Recognize (0+1)*000(0+1)*
%{
#include
<stdio.h>
int
count=
0
;
%}
str
[0-1]*"000"[0-1]*
err
[a-zA-Z0-9]+
%%
{str}
{ count++; }
{err}
%%
int
main()
{
yylex();
printf(
"The pattern (0+1)*000(0+1)* found %d times
\n
"
,count);
}
int
yywrap()
{
return
1
;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment