This work-in-progress MR adds better support for syntax errors in the parser -- the basic feature of printing the faulty location. However it appears that I got something wrong, as the column locations printed seem incorrect. I ran out of time to fix the issues (more exciting Inferno things to hack on!), so I'm sending the MR as a draft in the hope that I will be motivated to investigate and improve it later.
I'm seeing a lot of parsing errors these last few weeks, because @omartino implemented a check that the pretty-printer and parsers roundtrip (in TestMLRandom). In practice quite often I get one of them wrong (it happened to me for typed holes for example) and the random generator finds the bug. But debugging syntax errors occurring in the pretty-printing of randomly-generated program is difficult, as I don't know the source in the first place. This MR is supposed to improve the situation slightly, but in practice things are still fairly painful, and I am not sure how to improve. (I think that showing the full line of input that is faulty, with the error part underlined, would be helpful to locate where in the grammar the issue is, but this is way over my current error-message complexity budget.)