On Jan 2, 2007, at 0:08 , Martin Huschenbett wrote:
Hi,
my aim is to transform an XML file into C++ source code with a
Haskell program. The part that parses the XML is already finished
(using HaXML) but the part that generates the C++ code is still
remaining. Is there already any work on this topic? Maybe even on
generating Java or any other object oriented or imperative language.
My first approach was to simply generate the C++ code as text using
a pretty printing library but this becomes ugly very fast. Next I
thought about generating and rendering the AST of the resulting C++
code. But I don't want to reinvent the wheel.
When I want to generate source code, I often write a grammar for the
language fragment that I need and use BNFC (http://www.cs.chalmers.se/
~markus/BNFC/) to make a pretty-printer. If you want nicely indented
output, you sometimes have to tweak the generated pretty-printer a bit.
/Bjorn
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe