<div dir="ltr">I have just uploaded to Hackage the Pinchot library:<div><br></div><div><a href="https://hackage.haskell.org/package/pinchot">https://hackage.haskell.org/package/pinchot</a><br></div><div><br></div><div>I also have a pull request to get it into Stackage so hopefully it should be there in a few days as well.</div><div><br></div><div>Pinchot provides a simple monadic language that you use to describe a context-free grammar. Using this language you build a value that represents your grammar.  Then, using this value and Template Haskell, you can automatically generate a complete set of data types that correspond to the rules in your context-free grammar.</div><div><br></div><div>You also use Template Haskell to generate an Earley grammar for your language, using the Haskell Earley library:</div><div><br></div><div><a href="https://hackage.haskell.org/package/Earley">https://hackage.haskell.org/package/Earley</a><br></div><div><br></div><div>Unlike parsers such as Parsec and Happy, Earley parses all context-free grammars, regardless of the amount of necessary look-ahead or the presence of left recursion.  Earley does not, however, parse context-sensitive grammars.</div><div><br></div><div>Pinchot is documented and comes with several examples.  It passes several simple tests but it has not yet been used in anger.</div><div><br></div><div>I wrote Pinchot because I was excited to see Earley when it was released.  Finally we had a parser that would simply parse context-free grammars.  Give a grammar, get a parser.  Parsec and its ilk, on the other hand, are libraries allowing you to write a recursive-descent parser by hand.  That's useful, but if you know you have a context-free grammar it's easier to use a tool tailored to that.</div><div><br></div><div>So when using Earley I found myself writing the data types and then writing the Earley grammar specification.  This was a rote process ripe for automation.</div></div>