C# importer ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

C# importer ?

Johan Fabry
Hi all,

And now it looks like I will need to analyze a part of our own code, written in C#. Is there a parser for C# in Moose and if so, how extensive/solid is it?

TIA
--
Johan Fabry,  Senior Software Engineer. 
[hidden email] | Email too brief? Here's why! http://emailcharter.org

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: C# importer ?

Usman Bhatti
Hi John,

Sorry for the late reply.

I worked on a C# (MSIL) importer a few years back while I was working in Inria.

This parser was based on Mono project and a library Mono.Cecil that provides API to access MSIL.

The importer I wrote was able to extract the basic information required  to create FAMIX model (Classes, Namespaces, methods, attributes, invocations, accesses, params).
I think it might also have started to extract Generics but that part might not be complete. I didn't rewrite FAME/FAMIX for C# but used a library to transform FAME/FAMIX in Java to C#.
That meant that I could reuse the meta-model + MSE import/export from existing code. 

But I haven't been able to work on it since 6 years now. But if you are interested, you may have a look here at the code here:

One day when I get some time I would like to replace Mono.Cecil with Microsoft's parser that has been opensourced since.

HTH,

regards.
Usman





 

On Thu, Apr 12, 2018 at 12:09 PM, Johan Fabry <[hidden email]> wrote:
Hi all,

And now it looks like I will need to analyze a part of our own code, written in C#. Is there a parser for C# in Moose and if so, how extensive/solid is it?

TIA
--
Johan Fabry,  Senior Software Engineer. 
[hidden email] | Email too brief? Here's why! http://emailcharter.org

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: C# importer ?

Johan Fabry

Hi Usman,

 

Thanks for the reply! In the mean time I have been looking at using Roslyn: the .NET reflection API's, to make a XML dump of the structure of the code. I am almost there so I will keep going this route.

 

Now I can write a basic class structure with simple call information, and it's only 160 LOC of C# code. But the thing is that parsing is not enough, I also want the semantic analysis that gives type information (argument types, receiver type) and I don’t want to write that myself. Roslyn is supposed to give me that as well so I am investigating that now.

 

--

Johan Fabry,  Senior Software Engineer. 

[hidden email] | Email too brief? Here's whyhttp://emailcharter.org

 

From: Moose-dev [mailto:[hidden email]] On Behalf Of Usman Bhatti
Sent: Monday, April 16, 2018 9:59 AM
To: Moose-related development <[hidden email]>
Subject: [Moose-dev] Re: C# importer ?

 

Hi John,

 

Sorry for the late reply.

 

I worked on a C# (MSIL) importer a few years back while I was working in Inria.

 

This parser was based on Mono project and a library Mono.Cecil that provides API to access MSIL.

 

The importer I wrote was able to extract the basic information required  to create FAMIX model (Classes, Namespaces, methods, attributes, invocations, accesses, params).

I think it might also have started to extract Generics but that part might not be complete. I didn't rewrite FAME/FAMIX for C# but used a library to transform FAME/FAMIX in Java to C#.

That meant that I could reuse the meta-model + MSE import/export from existing code. 

 

But I haven't been able to work on it since 6 years now. But if you are interested, you may have a look here at the code here:

 

One day when I get some time I would like to replace Mono.Cecil with Microsoft's parser that has been opensourced since.

 

HTH,

 

regards.

Usman

 

 

 

 

 

 

 

On Thu, Apr 12, 2018 at 12:09 PM, Johan Fabry <[hidden email]> wrote:

Hi all,

And now it looks like I will need to analyze a part of our own code, written in C#. Is there a parser for C# in Moose and if so, how extensive/solid is it?

TIA
--
Johan Fabry,  Senior Software Engineer. 
[hidden email] | Email too brief? Here's why! http://emailcharter.org

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

 


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: C# importer ?

Usman Bhatti


On Mon, Apr 16, 2018 at 10:07 AM, Johan Fabry <[hidden email]> wrote:

Hi Usman,

 

Thanks for the reply! In the mean time I have been looking at using Roslyn: the .NET reflection API's, to make a XML dump of the structure of the code. I am almost there so I will keep going this route.


Excellent!
 

 

Now I can write a basic class structure with simple call information, and it's only 160 LOC of C# code. But the thing is that parsing is not enough, I also want the semantic analysis that gives type information (argument types, receiver type) and I don’t want to write that myself. Roslyn is supposed to give me that as well so I am investigating that now.


I hope it does.
Now, Mono.Cecil also does name resolution but sometimes I encountered limitations with it hence I would also support that you go for a solution provided by MS.

regards.
Usman
 

 

--

Johan Fabry,  Senior Software Engineer. 

[hidden email] | Email too brief? Here's whyhttp://emailcharter.org

 

From: Moose-dev [mailto:[hidden email]] On Behalf Of Usman Bhatti
Sent: Monday, April 16, 2018 9:59 AM
To: Moose-related development <[hidden email]>
Subject: [Moose-dev] Re: C# importer ?

 

Hi John,

 

Sorry for the late reply.

 

I worked on a C# (MSIL) importer a few years back while I was working in Inria.

 

This parser was based on Mono project and a library Mono.Cecil that provides API to access MSIL.

 

The importer I wrote was able to extract the basic information required  to create FAMIX model (Classes, Namespaces, methods, attributes, invocations, accesses, params).

I think it might also have started to extract Generics but that part might not be complete. I didn't rewrite FAME/FAMIX for C# but used a library to transform FAME/FAMIX in Java to C#.

That meant that I could reuse the meta-model + MSE import/export from existing code. 

 

But I haven't been able to work on it since 6 years now. But if you are interested, you may have a look here at the code here:

 

One day when I get some time I would like to replace Mono.Cecil with Microsoft's parser that has been opensourced since.

 

HTH,

 

regards.

Usman

 

 

 

 

 

 

 

On Thu, Apr 12, 2018 at 12:09 PM, Johan Fabry <[hidden email]> wrote:

Hi all,

And now it looks like I will need to analyze a part of our own code, written in C#. Is there a parser for C# in Moose and if so, how extensive/solid is it?

TIA
--
Johan Fabry,  Senior Software Engineer. 
[hidden email] | Email too brief? Here's why! http://emailcharter.org

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

 


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev