Hacker News new | ask | show | jobs
by benibela 2102 days ago
>Most people readily agree that recursive descent parsers can provide the best possible error messages,

Well, it could, but not all of them do.

My hand-written parsers are pretty bad at it. At the lowest level I run through a string char by char and test whether it parses correctly, i.e. like: p++; if (*p != '(') throw "expected (";

At first this does not even give a line number with the error.