Whenever flex can not match the input it says "flex scanner jammed". ==================================================================== You need to add a rule that matches the otherwise-unmatched text, e.g., %option yylineno %% [[a bunch of rules here]] . printf("bad input character '%s' at line %d\n", yytext, yylineno); See '%option default' for more information.