First just start using readline(), which adds shell-like like input line-editing. In a second step start using the readline lib's history features too.
Using readline() has the additional advantage that the lexer always works from string buffers supplied by our custom YY_INPUT macro, instead of stdin. This paves the way for multiple input files #18 and user defined functions #17.