Perform action from Parsed content

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking to see if there is an example or pseudo code for how to have a
C# application read a text file and perform an action that is parsed from the
text file. For example


TestDoc.txt
================================

This is a list of values:

<# for (int i = 0; i < mylist.count; i++)
{
writeout( "parm[" + i + "] = " + myList + "\n" )
}
#>


Input
================================
mylist[0] = "Hello World";
mylist[1] = "Goodbye World";



TestDoc_output.txt
================================
This is a list of values:

parm[0] = Hello World
parm[1] = Goodbye World
 
IMO there are following ways how you can "execute" some kind of pseudo code.

1. Write translator from pseudo code to C#, then use System.CodeDom (
ICodeCompiler ) to compile the code, and finally load compiled assembly and
execute code.

2. Translate pseudo code into IL using System.Reflection.Emit and then
exucute

3. Microsoft.Vsa, however it uses predefined script language e.g. JavaScript
 
Back
Top