Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 public override EVariable Solve(EScope scope)
 {
     return(EVariable.New(type));
 }