Language Processor
Wednesday, July 27, 2011
Recognize aa(a+b)*bb
%{
#include
<stdio.h>
int
count=
0
;
%}
str
"aa"[ab]*"bb"
err
[a-zA-Z0-9]+
%%
{str}
{ count++; }
{err}
%%
int
main()
{
yylex();
printf(
"The pattern aa(a+b)*bb 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