Introduce ParseResult type

So that parsing can return error messages instead of just failing