i recall two common fault i had with lex, one is when there is no new line at end of file, second one is when a new rule beginning/terminator (%%) does not start on beginning of line.