Skip to content

Current Problems / Tasks #1

Open

Description

@david-andrew

TODOs

  • ability to import a parser into the REPL, just can't construct anything in the repl
    • so class A(Rule): ... or A = B|C|D, or any other expression over a Rule should raise an exception, but importing and using should be fine
  • add support for building grammars across multiple files
  • error messages using the prettyerr library
    • consider user defined error hooks into parsing process. TBD exactly what interface would work
  • improve the README. have 1 good example, mention grammars must be defined in files, better explanation of GLL backend, etc.
  • make it so optional elements are None, not empty array. e.g. missing exponent or missing fractional part of json
  • [-] pull json imports out of test json imports and put in test hydration
  • mixins
    • probably better to just support user defined def convert(self) -> Whatever: ...
  • add more grammar examples + corresponding tests
    • test CSV grammar
    • improve the CSV grammar
  • add support for longest match disambiguation rule
  • make disambiguation rules filter during parsing rather than after parsing so that the algorithm is more efficient on ambiguous grammars
  • support whitespace policy
    • default Explicit
    • SkipUnexpectedWhitespace
      • blacklist or whitelist to specify which characters are skipable
      • basically before trying to eat the next part of a rule, skip all whitespace (assuming rule doesn't contain whitespace)
      • this could also be useful for e.g. phone numbers where various delimiters are unimportant (parenthesis, dash, space, etc.)
  • ability to skip junk before and or after a parse. in principle we could have a single meta rule that you parameterize with your rule? we would need a new disambiguation which is essentially eat until next rule could start. Alternatively a dumb approach would be to try to eat, progressing one token at a time when failing, until we find the spot we can start from
  • filter for rejecting parses. e.g. say we want to parse a number 0-255, should be able to easily say if > 255 fail this branch
  • helper for wrapping and optional wrapping. E.g. wrap[A, ['(',')'], None] -> (A)|A. Experiment to find best ergonomics

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions