to the beginning of the file. The lexer calls yywrap() when it reaches the end of the file; you probably don't need to use it, and %option noyywrap will tell flex not to call it. By default, flex generates a function called yylex(); %option main tells it to also generate a main() function that calls yylex.