コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="root"></param>
 public void Start(DynAstNodeRoot root)
 {
     try
     {
         foreach (var n in root.Statements)
         {
             switch (n.Type)
             {
             case DynAstType.FunctionDefine:
                 CreateFunction(n as DynAstNodeFunctionDefine);
                 break;
             }
         }
         mainTypeBuider.CreateType();
     }
     catch (DynException e)
     {
         LastError = $"{e.Message} {e.StackTrace}";
     }
 }
コード例 #2
0
        public void Interpret(DynAstNodeRoot root)
        {
            AppDomain domain = AppDomain.CreateDomain(name, null, setup);

            try
            {
                DynMachine machine = domain.CreateInstanceAndUnwrap(
                    typeof(DynMachine).Assembly.FullName,
                    typeof(DynMachine).FullName
                    ) as DynMachine;
                machine.Start(root);
                machine.Save();
                Console.WriteLine("save : {0}", machine.LastError);
                machine.Run();
                Console.WriteLine("run : {0}", machine.LastError);
            }
            finally
            {
                AppDomain.Unload(domain);
            }
        }