private EVariable Calc(EVariable a, EVariable b) { EVariable convA = a; EVariable convB = b; if (input.HasValue) { EType inputType = input.Value; convA = a.Convert(inputType); convB = b.Convert(inputType); } dynamic convC = calc(convA.Get(), convB.Get()); return(EVariable.New(output).Set(convC)); }
public override EVariable Exec(EScope scope) { EVariable newVar = new EVVoid(); foreach (EWord variable in variables) { newVar = EVariable.New(type); scope.Set(variable.ToString(), newVar); } if (assignOperations != null) { foreach (EAssignOperation assignOp in assignOperations) { assignOp.Exec(scope); } } return(newVar); }
public override EVariable Exec(EScope scope, ESolvable[] args) { // TODO: output type casting if (args.Length != arguments.Length) { throw new ELangException("Wrong amount of args for function " + name); } EScope lowerScope = scope.GetChild(); for (int i = 0; i < arguments.Length; i++) { string argname = arguments[i].GetVariable().ToString(); ETypeWord argtype = arguments[i].GetEType(); EVariable solved = EVariable.New(argtype).Assign(args[i].Solve(lowerScope)); lowerScope.Set(argname, solved); } return(Interpreter.Run(program, lowerScope)); }
public override EVariable Solve(EScope scope) { return(EVariable.New(type)); }