inputLine returns string option, and I assume that is expected string.
What you want to do, or has makeLexerto take string option, for example:
fun makeLexer NONE = <whatever you want to do when stream is empty>
| makeLexer (SOME s) = <the normal body makeLexer, working on the string s>
or change your line to:
val lexer = makeLexer( fn n => valOf ( inputLine( stdIn ) ) );
valOf takes the type of option and unpacks it.
, inputLine NONE, , , , .