monadic lexer and parser