gll icon indicating copy to clipboard operation
gll copied to clipboard

Would love to see more about error handling

Open Engelberg opened this issue 12 years ago • 1 comments

This is a fantastic article! It seems to me that since the final version lazily produces complete parse successes and ignores everything else, there's no good way to get at the failures. Actually, since so many intermediate failures are potentially produced in a complex or ambiguous grammar, it's not even clear what would be the "right" failure to display.

Can you demonstrate a version with better error handling? Thanks.

Engelberg avatar Jan 18 '13 09:01 Engelberg

Thanks! Yes, the parsers currently return an empty list if nothing matches. A better approach is to return a list of successes if there is at least one success, and a list of failures otherwise. The user may then be presented with the failure that consumes most of the input string. This is the solution used by Daniel Spiewak in his gll-combinators framework. Furthermore, one can define a more detailed data structure for failures than what is presented in the article.

Thanks for the feedback, I'll improve the article.

epsil avatar Jan 20 '13 16:01 epsil