Re:SWIG author on the complexity of SWIG
by daeken on Monday August 29, 2011 @01:12PM
(#2937912)
I've been thinking about how to do this effectively and cleanly for a while now, and I wonder if the right path isn't to use clang to parse the C or C++ code and then generate interfaces from the LLVM IR. As far as I know, all the metadata you need is there, so it might prove simpler than parsing things on your own.
[ Parent
| on HN ]
We've done this. A modified clang-interpreter spits out some json. Python scripts consume the it and generate reflection data, script bindings etc.
We're very happy with the results. It's a little bit slower than hand parsing the headers, but the robustness more than compensates for it. We set up a unity build (just for the headers) to make up the speed difference.
Re:SWIG author on the complexity of SWIG
by JabavuAdams on Monday August 29, 2011 @02:26PM
(#2938223)
Also have a look at doxygen. It can emit xml describing the code, rather than documentation.