예제 #1
0
        // Run a program
        public static EVariable Run(EProgram program, EScope scope)
        {
            // Create a variable to assign the output to
            EVariable output = new EVVoid();

            // Loop over every instruction and return the last value
            EOperation[] operations = program.GetOperations();
            foreach (EOperation operation in operations)
            {
                output = operation.Exec(scope);
            }
            return(output);
        }
예제 #2
0
        public override EVariable Exec(EScope scope)
        {
            Func <bool> checkVar = () => (
                (EVBoolean)
                check.Solve(scope)
                .Convert(EType.Boolean)
                ).Get();

            EVariable output = new EVVoid();

            while (checkVar())
            {
                EScope subScope = scope.GetChild();
                output = Interpreter.Run(program, subScope);
            }

            return(output);
        }
예제 #3
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);
        }