Skip to content

The matching process should not be exception-based #132

@andr-dots

Description

@andr-dots

Currently, the parsing process relies heavily on the exception mechanism by throwing an exception every time a rule fails to match. But the exception realization is very slow, so the parsing process that has a lot of failing rules would be slow too. "Zero-cost exceptions" are only fair in such cases where no exceptions are raised (every rule always matches successfully).

The ParsingExpression class and its descendants should be rewritten to return the error explicitly. I suggest returning an error as the second return value of the parse() and _parse() methods. Since Python exceptions are announced as "zero-cost", there is a chance of backward compatibility with the previous versions of Arpeggio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions