Conversation
Edited 5 months ago

parsy is by far the best parser I have ever used. either this library in particular is just fucking stellar or combinator-based parsing in general is a really really good idea. I don’t even know what a combinator is but like:

  • your parsing code is basically just declaring what the data you’re parsing looks like and what to do with it. you don’t have to write any tricky algorithms you just tell it what to look for
  • instead of getting a big messy blob of “parsed” gobbledygook at the end, you get whatever data structures (including class instances!) you told the parser to create at every step of the way. so you don’t have to have a second layer of hand-written parsing code where you try to make sense of the parser’s output
1
2
5

@kasdeya This description heavily reminds me of the parsec school of parsers in . I find the original parsec library serviceable enough for most use cases, but nonetheless libraries such as attoparsec and megaparsec exist to deliver some kind of improvement on it.

1
0
2

@fargate I’ve heard that libraries like parsy are heavily inspired by a functional approach to parsing (which explains the mathy term “combinator”) so this doesn’t surprise me at all. and speaking of which, I’ve actually been thinking about giving Haskell another try at some point, because I’ve been missing some of its features (like being able to turn any function into an infix operator, and having a type system that can handle all kinds of weird {function transform currying nonsense} and still make sure that the types are correct at the end)

(although, I haven’t decided if I want to try Haskell again or try J# instead)

0
0
0