%{ int anzahl=0; %} string abb %% {string} { printf("[%s]",yytext); anzahl++; } %% int yywrap(){ printf("Anzahl: %d\n",anzahl); return(1); }