[Haskell-cafe] combined parsing & pretty-printing

Brent Yorgey byorgey at seas.upenn.edu
Wed Jan 26 17:42:23 CET 2011


On Wed, Jan 26, 2011 at 04:22:00PM +0000, Ozgur Akgun wrote:
> Dear Café,
> 
> I working on a DSL represented by a algebraic data type with many
> constructors. I can write (separately) a parser and a pretty-printer for it,
> and I am doing so at the moment. However, this way it feels like repeating
> the same information twice.
> 
> Is there any work to combine the two?

Maybe take a look at "Invertible Syntax Descriptions: Unifying Parsing
and Pretty Printing" by Tillmann Rendel and Klaus Ostermann from last
year's Haskell Symposium:

  http://www.informatik.uni-marburg.de/~rendel/unparse/

It's a beautiful paper, and perhaps the code will work for you
(although it's too bad it's not on Hackage).

-Brent



More information about the Haskell-Cafe mailing list