public override Value Evaluate(IMutableVariableStack<Value> Stack) { TupleValue tuple = (TupleValue)this.SourceTuple.Evaluate(Stack); if (tuple.Values != null) { return this.InnerExpression.Evaluate((IMutableVariableStack<Value>)Stack.Append(tuple.Values)); } else { return this.InnerExpression.Evaluate(Stack); } }
public override Value Evaluate(IMutableVariableStack<Value> Stack) { Value val = null; Stack.Lookup(this.Index, ref val); return val; }
public override Value Evaluate(IMutableVariableStack<Value> Stack) { return this.Datum.Value; }
public override Value Evaluate(IMutableVariableStack<Value> Stack) { return new ExpressionFunction((IMutableVariableStack<Value>)((IMutableVariableStack<Value>)Stack.Cut(this.ArgumentIndex)).Freeze, this.Function); }
public override Value Evaluate(IMutableVariableStack<Value> Stack) { return (this.Function.Evaluate(Stack) as FunctionValue).Call(this.Argument.Evaluate(Stack)); }
/// <summary> /// Evaluates the expression with the given immediate value stack. /// </summary> public virtual Value Evaluate(IMutableVariableStack<Value> Stack) { return null; }
public override Value Evaluate(IMutableVariableStack<Value> Stack) { if (this.Parts != null) { Value[] vals = new Value[this.Parts.Length]; for (int t = 0; t < this.Parts.Length; t++) { vals[t] = this.Parts[t].Evaluate(Stack); } return new TupleValue(vals); } else { return TupleValue.Empty; } }
/// <summary> /// Creates stacks and information about the root scope of this input. /// </summary> public void PrepareRootScope(out Scope Scope, out IMutableVariableStack<Value> Stack, out IVariableStack<Expression> TypeStack) { Dictionary<string, int> varmap = new Dictionary<string, int>(); Value[] vals = new Value[this._RootVariables.Count]; Expression[] types = new Expression[vals.Length]; for (int t = 0; t < vals.Length; t++) { vals[t] = this._RootVariables[t].Value; types[t] = this._RootVariables[t].Type; varmap.Add(this._RootVariables[t].Name, t); } Scope = new Scope() { Variables = varmap, NextFreeIndex = vals.Length }; Stack = new SpaghettiStack<Value>(vals); TypeStack = new SpaghettiStack<Expression>(types); }
public ExpressionFunction(IMutableVariableStack<Value> BaseStack, Expression Expression) { this.BaseStack = BaseStack; this.Expression = Expression; }