Hi Everyone, Thanks for everyone's kind responses: very helpful so far!
I fully appreciate and understand how difficult writing a C++ parser is. However I may need one for our new Paraphrase project, where I may be targeting C++ for writing a refactoring tool. Obviously I don't want to start writing one myself, hence I was asking if anyone new about an already existing implementation. Rose looks interesting, I'll check that out, thanks! Chris. On 24 Jan 2012, at 14:40, Jason Dagit wrote: > On Tue, Jan 24, 2012 at 2:06 AM, Christopher Brown > <cm...@st-andrews.ac.uk> wrote: >> Hi, >> >> I have stumbled across language-c on hackage and I was wondering if anyone >> is aware if there exists a full C++ parser written in Haskell? > > I don't think one exists. I've heard it's quite difficult to get > template parsing working in an efficient manner. > > My understanding is that "real" C++ compilers use the Edison Design > Group's parser: http://www.edg.com/index.php?location=c_frontend > > For example, the Intel C++ compiler uses the edg front-end: > http://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler > > I thought even microsoft's compiler (which is surprisingly c++ > compliant) uses it but I can't find details on google about that. > > There is at least one open source project using it, rose, so it's not > unthinkingable to use it from Haskell: http://rosecompiler.org/ > > Rose has had working haskell bindings in the past but they have bit > rotted a bit. With rose you get support for much more than parsing > C++. You also get C and Fortran parsers as well as a fair bit of > static analysis. The downside is that rose is a big pile of C++ > itself and is hard to compile on some platforms. > > If you made a BSD3 licensed, fully functional, efficient C++ parser > that would be great. If you made it so that it preserves comments and > the input well enough to do source to source transformations > (unparsing) that would be very useful. I often wish I had rose > implemented in Haskell instead of C++. > > Jason _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe