parsica-php / parsica

Parsica - PHP Parser Combinators - The easiest way to build robust parsers.
https://parsica-php.github.io/
MIT License
405 stars 18 forks source link

Learning Parsica #50

Open matthiasnoback opened 3 years ago

matthiasnoback commented 3 years ago

In response to @mathiasverraes ' tweet here:

I think the documentation is very useful and developer-friendly already. I thought of a couple of things that might be improved:

Great work on the type annotations by the way, those are really helpful, and I think it's amazing that this is now possible in PHP today.

Thanks a lot for this awesome library! It was a nice thing to dive in and get to know.

mathiasverraes commented 3 years ago

shows some simple regexes and then shows and explains the alternative using parsers

Excellent idea. The obvious difference is that combinators for complex parsers are more readable and writable (after paying the learning cost).

One major but more subtle difference between combinators and regexes (and grammars and tokenisers) is that with the combinators, you parse and build your final data structures in one step. The docs could reflect that.

Agreed with all the other remarks as well, and mea culpa for the @deprecated, that's entirely on me. I was going to clean that all up before the 0.5 release :-S

Thanks for putting in the effort of giving feedback, much appreciated!

turanct commented 3 years ago

Much appreciated indeed! I will look into it a bit more when some time frees up. My daughter was born this week! 🍼👶

matthiasnoback commented 3 years ago

My daughter was born this week! baby_bottlebaby

Ah, great news, congratulations!

It remains an extremely cool tool that I'll keep using, regardless of when you'll have time to work on performance or other issues. I'll probably blog about it at some point as well.