Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » KDM Model Creation from C++ code?(How to create a KDM Model from C++ source code.)
KDM Model Creation from C++ code? [message #990924] Fri, 14 December 2012 22:27 Go to next message
Bill White is currently offline Bill White
Messages: 8
Registered: September 2012
Junior Member
I'm trying to understand a big C++ program. I'm wondering if I can build a tool which parses the C++ and generates an ecore model. I'm pretty sure I can parse the C++, using either clang or a commercial C++ parser I have available. But I'm not sure what the format the model should take.

I could generate an ecore model directly, using what seems to be the ecore schema. It's not clear to me if there is a specification for the serialized from of ecore models, and this seems somewhat dubious. I know that Modisco has no C++ discoverer, but it has a KDM discoverer, and that KDM is some very abstract knowledge representation scheme. So maybe it would be possible to traverse the C++ code and write a KDM model, and then extract that with Modisco. But I'm not sure what the steps to create this would be. Clang makes is pretty easy to parse and process the C++, and that seems like it would be the easy part.

I don't need to generate C++ or Java code, or translate it. I just want to
be able to understand the C++ code.

So, I guess my questions are:


  1. Is there documentation for the serialized format of an ecore model? Could I just write an XML file with the model? If I did that, would I need Modisco at all?
  2. Does it make sense to write a KDM model, then use Modisco's KDM discoverer to extract the ecore model. Is there something which will do this?
  3. Does it make even more sense to create a simple XSD schema for my simple-minded C++ model, and dump the C++ data model to my XML schema, then use the EMF schema reading tools somehow (unknown to me) to turn this into an ecore model. I'd have to specify the translation from my XSD schema to ecore, but presumably this is well understood.



Thanks. Hope this is not too confusing.

Re: KDM Model Creation from C++ code? [message #991347 is a reply to message #990924] Tue, 18 December 2012 15:57 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 607
Registered: July 2009
Senior Member
Hello,

Thanks for looking to our MoDisco project.
I encourage you to take a deeper look into the MoDisco Reference Documentation in order to have a more complete vision of what is provided.

If your purpose is about (better) understanding C++ code by getting a model out of it, you can get inspired by the already provided support for Java.
The MoDisco Java Discoverer basically allows automatically obtaining a Java model (which conforms to a Java metamodel) out of any Java project.
Technically, this generic Java discoverer has been implemented by using the Eclipse JDT features (notably the provided AST).
In addition to the Java Model Discoverer, transformations from the Java metamodel to the KDM metamodel and then to the UML metamodel have also bee implemented allowing to also produce corresponding models.
Finally, all these models can be navigated efficiently thanks to the generic MoDisco Model Browser and related Customization features.

Following this approach, you could provide exactly the same type of support for C++.
Notably, there is the Eclipse CDT project that could be used as a base to implement a C++ Model Discoverer.

I hope this helps.

Best regards,

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: KDM Model Creation from C++ code? [message #1084872 is a reply to message #990924] Mon, 12 August 2013 06:59 Go to previous messageGo to next message
Umut Durak is currently offline Umut Durak
Messages: 1
Registered: August 2013
Junior Member
Hi,
It seems there are some requirements for c++ discover features for MoDisco (I also need it a lot!). Is there any one started drafting a code? It might be good idea to incubate a small project out of it.
Re: KDM Model Creation from C++ code? [message #1085145 is a reply to message #1084872] Mon, 12 August 2013 14:08 Go to previous message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 607
Registered: July 2009
Senior Member
Hello,

Thanks for your interest on this particular topic relevant for the community.
We would also be glad to know (and follow) any initiative intending to provide such a C/C++ model discovery feature, that could be potentially plugged into MoDisco.

Best regards,


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Previous Topic:Status of CDO Backend?
Next Topic:Abstraction layer
Goto Forum:
  


Current Time: Tue Oct 21 02:29:47 GMT 2014

Powered by FUDForum. Page generated in 0.03078 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software