Professional Documents
Culture Documents
[ \t\n]
{delim}+
[A-Za-z]
[0-9]
{letter}({letter}|{digit})*
{digit}+(\.{digit}+)?(E[+\-]?{digit}+)?
%%
{ws}
if
else
auto
double
int
struct
break
long
switch
case
enum
register
typedef
char
{}
{count(IF);}
{count(ELSE);}
{count(AUTO);}
{count(DOUBLE);}
{count(INT);}
{count(STRUCT);}
{count(BREAK);}
{count(LONG);}
{count(SWITCH);}
{count(CASE);}
{count(ENUM);}
{count(REGISTER);}
{count(TYPEDEF);}
{count(CHAR);}
extern
return
union
const
float
short
unsigned
continue
for
static
void
default
goto
sizeof
volatile
do
signed
while
{count(EXTERN);}
{count(RETURN);}
{count(UNION);}
{count(CONST);}
{count(FLOAT);}
{count(SHORT);}
{count(UNSIGNED);}
{count(CONTINUE);}
{count(FOR);}
{count(STATIC);}
{count(VOID);}
{count(DEFAULT);}
{count(GOTO);}
{count(SIZEOF);}
{count(VOLATILE);}
{count(DO);}
{count(SIGNED);}
{count(WHILE);}
{id}
{number}
"<"
"<="
"="
"<>"
">"
">="
"("
")"
";"
%%
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
count(int n)
{
c[n]+=1;
}
main(int argc,char **argv){
yyin = fopen("bitmap.c","r");
yyout = fopen("output.txt","w");
yylex();
int i;
for(i = 0;i<32;i++)
{
fprintf(yyout,"%d\n",c[i]);
}
}
yywrap(){
}