News for hackers. Stuff that matters.
Re:Combinator Parsing by phpnode on Monday May 05, 2014 @08:14AM (#7698066)
isn't there a good PEG available for python? Compare the source code in the post to the equivalent PEG.js grammar - http://pegjs.majda.cz/online
Re:Combinator Parsing by Ygg2 on Monday May 05, 2014 @09:21AM (#7698382)
What is the relationship between PEG parsers and Parser Combinators?
Re:Combinator Parsing by MarkCC on Monday May 05, 2014 @10:10AM (#7698625)
(Original blogpost author here.)

They're pretty much orthogonal.

PEG is a particular parsing technique. Combinators are a technique for implementing parsers.

You can write a parser combinator library which uses PEG or packrat algorithms underneath.

In this blog post, the library that I'm using is basically building LL parse generators, not PEG. But you could easily implement a PEG-based combinator system.

I didn't do that, because I didn't want to get bogged down with explaining too much about parsing algorithms. The LL/recursive descent approach is pretty easy to understand when you see the grammar code. For PEG, I would have needed to spend more time explaining the algorithms, and the post was already too long!

Re:Combinator Parsing by jerf on Monday May 05, 2014 @09:45AM (#7698499)
That's not quite equivalent; the JS doesn't do division or subtraction.

The Python syntax is a bit klunky. The Haskell equivalent is on par with the PEG. I don't know how they compare as the grammars become non-trivial.