[cfe-dev] Using the Clang AST to generate other abstract models

Guy Sherman guy at guysherman.com
Sun Jun 29 03:02:57 PDT 2014


Hi Nikola,

I would be more than happy to contribute my work back… MSE is not an XML-based format though. Although I guess say I could use XML as an intermediate format. Would the AST-dump code be the best starting point either way?

Thanks,

Guy.

On 29/06/2014, at 9:51 pm, Nikola Smiljanic <popizdeh at gmail.com> wrote:

> Hi Guy, clang used to have xml printer long time ago but it was removed as it lacked in many ways. This came up a few times and I think the community is not opposed to having this functionality, if done right. This is in case you're interested in contributing your changes back to clang. If not you can just hack away on your working copy.
> 
> Others might have better ideas, but you can search the mailing list for xml schema related discussion
> 
> Nikola.
> 
> 
> On Sun, Jun 29, 2014 at 7:17 PM, Guy Sherman <guy at guysherman.com> wrote:
> Hi There,
> 
> I’m new to this list and new to mucking around with compilers, so I crave your indulgence.
> 
> There is a suite of tools called Moose Tools (http://www.moosetechnology.org/), which is somewhat like a Business Intelligence platform for codebases. You convert a codebase to a model of that codebase, and then you can build queries on top of that mode, and visualisations on top of those queries. The models are called an “MSE” file, and they seem similar to an AST. 
> 
> So anyway, there are reasonably good tools to import codebases from java, smalltalk, etc, but nothing that I’ve tried for C/C++ seems to do the job. So, I did a little bit of reading about Clang and LLVM, and have been wanting to try using the Clang front-end but instead of spitting out LLVM IR I want to generate an MSE file. I had a look at the output from the AST-dump mode of Clang and it looks like the data would be suitable, I could probably write a python script to parse that output and convert it, but I would rather do it properly.
> 
> I’m not sure of the right approach though… I could start hacking on the AST-dump mode, but I imagine that this is not something that you would ever want to keep in the CFE codebase. So, is there some guidance somewhere, on putting together the minimal subset of the CFE that I would need in order to be able to dump the AST? Or should I just fork CFE and start from there?
> 
> 
> Many thanks,
> 
> 
> Guy Sherman.
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140629/ac9abb32/attachment.html>


More information about the cfe-dev mailing list