/// <summary> /// Runs the compiler hook/function call on the compiler languge binding class. /// </summary> /// <param name="objectName"></param> /// <param name="method"></param> /// <param name="settings"></param> /// <param name="expr"></param> /// <returns></returns> private object RunCompilerMethod(string objectName, string method, LangSettings settings, FunctionCallExpr expr) { var binding = new MetaCompiler(); binding.Ctx = expr.Ctx; binding.ExecuteFunction(method, new object[] { expr }); return(LObjects.Null); }
/// <summary> /// Executes a call to a language binding class. /// </summary> /// <param name="expr"></param> /// <returns></returns> public object VisitBindingCall(BindingCallExpr expr) { var method = expr.Name; // 1. Resolve the parameters. ParamHelper.ResolveParametersToHostLangValues(expr.ParamListExpressions, expr.ParamList, this); // 2. Push call into stack expr.Ctx.State.Stack.Push(expr.FullName, null); // 3. Call language binding method/function. var binding = new MetaCompiler(); binding.Ctx = expr.Ctx; var result = binding.ExecuteFunction(method, new object[] { expr }); result = FunctionHelper.CheckConvert(result); // 4. Pop the call stack expr.Ctx.State.Stack.Pop(); return(result); }
/// <summary> /// Invokes the SPV3 Compiler with the given arguments. /// </summary> /// <param name="args"> /// [0] = Source directory. /// [1] = Target directory. /// </param> public static void Main(string[] args) { if (args.Length < 2) { Exit("Not enough arguments!", 1); } var source = (Directory)args[0]; var target = (Directory)args[1]; if (!System.IO.Directory.Exists(source)) { Exit("Source does not exist.", 2); } if (!System.IO.Directory.Exists(target)) { Exit("Target does not exist.", 2); } try { Console.Clear(); Task.Run(() => { var compress = new InternalCompressor(); var compiler = new MetaCompiler(compress, Status); compiler.Compile(source, target); }) .GetAwaiter().GetResult(); Exit(Banner, 0); } catch (Exception exception) { Exit(exception.ToString(), 3); } }