AST from IL Code

Topics: ccisharp
Jun 13, 2012 at 1:52 PM
Edited Jun 13, 2012 at 2:12 PM

Hi,

 

I asked on SO how to translate IL Code into ASTs, and was pointed to this project. Although the framework seems to be very powerful, I'm not sure if it can fulfill my requirements. I need to manipulate assemblies on statement level. Are there any samples using expression trees?

 

Regards,

Matthias

Coordinator
Jun 14, 2012 at 3:23 PM

By "expression trees" do you mean LINQ expression trees, or just any AST like representation? If the latter, then check out the samples in the cciast project.

Jun 14, 2012 at 3:25 PM

Sorry, I mean LINQ expression trees... Is that possible too?

Coordinator
Jun 14, 2012 at 3:29 PM

Just about everything is possible in software, but there isn't any special support for LINQ expression trees. You'll have to do a very large chunk of work yourself. It is probably worth thinking about alternatives to using LINQ expressions.

One of the major problems you'll have to deal with is the meta nature of the problem. IL is not a serialization of LINQ epxressions, but a serialization of code that will construct LINQ expressions if executed in the right environment.