
26 Jan
2011
26 Jan
'11
11:42 a.m.
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