Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): add parser combinators #78

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

ecyrbe
Copy link
Collaborator

@ecyrbe ecyrbe commented Mar 5, 2023

This is a Combinator Parser with a lot of goodies:

  • advanced error handling for parsing errors
  • parser introspection to give better hints to users about the errors
  • multiple easy to understand primitives to create complex parsers
About recursive parsers (resolved) we get recursive too deep and probably infinite error. i only see trampolines as a workaround. This means complexify a lot the library. Because this implies returning a `ParserFn` in the composed parsers and calling those in a loop.

solution

was simply to remove ParserFn constraint

Combinators in this PR:

  • Helpers
    • Parse
    • ToString
  • Combinators
    • Literal
    • NotLiteral
    • Optional
    • Many
    • Many1
    • Sequence
    • EndOfInput
    • Choice
    • Or
    • Not
    • Whitespace
    • Whitespaces
    • Trim
    • TrimLeft
    • TrimRight
    • Any
    • CharRange
    • Alpha
    • AlphaNum
    • Digit
    • Digits
    • Word
    • SepBy
    • Between
  • Transformers
    • Map
    • MapError
    • Skip

@ecyrbe ecyrbe changed the title feat(parser): first impl for review feat(parser): add parser combinators Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants