Re:Owl: Parser generator for visibly pushdown languages
by jhpriestley on Wednesday November 07, 2018 @02:26PM
(#18401539)
What context or data would constitute a helpful error message in your opinion? Do you have an example of a recursive-descent parser that generates particularly good error messages?
Re:Owl: Parser generator for visibly pushdown languages
by chrisseaton on Wednesday November 07, 2018 @02:32PM
(#18401597)
A great example is if you forget to put 'end' at the end of a function at the end of a file in languages that have that.
Your idea of a good parser error message is being told that the end of file was unexpected and being given a list of a hundred possible tokens that could start another statement, including 'end' buried somewhere in the list, because that's what's valid there.
My idea of a good parser error message would be in a recursive descent parser looking for the 'end' token, not seeing it, seeing that it's end of file instead and saying 'missing 'end' or a new statement at end of file'.
Re:Owl: Parser generator for visibly pushdown languages
by nicoburns on Wednesday November 07, 2018 @08:38PM
(#18403781)
See elm and rust for examples of compilers with good error messages.
Re:Owl: Parser generator for visibly pushdown languages
by grandmczeb on Wednesday November 07, 2018 @09:16PM
(#18403917)
Or clang.
This is a garbage 'computer says no' kind of error message.
It doesn't tell you why those tokens would have been allowed to follow, why it is that those are the only tokens allowed to follow, why the token you used is not one of the allowed one, or what you could have more likely been intending to write to make it correct.
In a recursive descent parser you have the freedom to use more context and logic to generate your error messages.