is there a way to get an assembly to parse its own source code at runtime ?

  • Thread starter Thread starter Mad Scientist Jr
  • Start date Start date
M

Mad Scientist Jr

We have an old system that uses Scheme as its scripting language, that
many developers need to use, but 99% of our people know C# & .NET, not
Scheme. This system is not going away anytime soon. Some of us had the
bright idea to make a system to allow you to write the scripts in C#
(using VS.NET, with Intellisense, debugging, etc., and being able to
run the scripts from VS.NET), and then have it generate Scheme code
from its own source code. We can do it the old "one-two" way... for
every line of C# code you have one line of scheme generating code.
However this wouldn't work too well for SELECT CASE or IF/THEN/ELSE
blocks for the logic that is not running. So there would have to be a
completely seperate code base that the Scheme generator uses. Which is
hokey, since then you have to code your app twice. I was thinking maybe
there is a way to get an assembly to parse its own source code at
runtime? We could just write another app that works on the blah.cs
files, but the other way just sounds more fun.
 
I think the compile on the fly option will work for me... Has anyone
done this? If you have a text file "mycode.txt" with c# code in it, how
would you compile it from within your running app and then execute that
code (say, a method of a stateless object - myobject.mymethod) ?
 
Back
Top