3 ms·
What are those "good error messages" in the parsing stage you keep talking about? I don't remember I've ever used a language that reported anything different f
by marcosdumay 10y ago
What are those "good error messages" in the parsing stage you keep talking about?
I don't remember I've ever used a language that reported anything different from "syntax error at line X" at this stage.
- megous 10y agoYou can get a parser generator to automagically list you expected (non-)terminals at this point. It may not be helpful though, depending on the location of the error. But it is something at least.
- btilly 10y agoAs a random example from Perl, Unmatched ( in regex... is the error when you open a capturing group in a regex and fail to close it. In a recursive descent parser, this type of error is very easy to generate because working top down you know what you are in the middle of trying to do when you hit the error. But a bottom up parser lacks that context - it just knows where it was when it got stuck.