Skip to content

Use parser combinators instead of Regex #1

@pragmatrix

Description

@pragmatrix

I'm having a bit of a hard time implementing even simple parsers with Regexes. Therefore I am considering using a parser combinator framework:

Candidates are (ranked by dependents on crates.io):

  • 992: nom: Basically unusable syntax-wise, weirdest one, ancient, fast.
  • 98: LALRPOP: External files... Nooooo.
  • 58: combine: Inspired by Parsec, trait heavy, a bit of trouble passing parsers around. Lots of success stories.
  • 20: pom: PEG, so far no downsides. Looks similar to the one I built for F#. slow at construction time
  • 5: Chomp: TODO
  • 0: Chumsky: Similar to pom. New.

TODO:

  • How can we reuse parsers, constructing them may be expensive.

    We can use once_cell, no locking involved if static is already initialized, just one atomic memory read.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions