Skip to content

Would love to see more about error handling #1

Open

Description

@Engelberg

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.

Activity

  1. epsil commented on Jan 20, 2013

    @epsil
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions