Add parse error messages

Those messages are very primitives but still much more helpful than just "parse error". In particular, they work well when a token has been omitted (e.g. missing `then` or `[]` was used instead of `of`).

Since implementing this had such a bad impact on performance, I also attached two performance patches to help balance it out.