public Interpreter(Expression expression) { scopeStack = new Stack<ScopeTreeNode>(); ScopeTreeRoot = new ScopeTreeNode(Permanency.Permanent); RootExpression = expression; Log = new List<LogEntry>(); }
public Expression BuildExpressionTree(List<Token> tokens, int startIndex) { var res = new Expression(tokens[startIndex]); int currentIndex = startIndex + 1; while (tokens.Count > currentIndex && !IsClosedBracket(tokens[currentIndex])) { if (IsOpenBracket(tokens[currentIndex])) { var subExpression = BuildExpressionTree(tokens, currentIndex); //if (subExpression.Sequence.Count != 0) res.Sequence.Add(subExpression); currentIndex += subExpression.GetNumTokens() - 1; } else res.Sequence.Add(new ExpressionItem(tokens[currentIndex])); currentIndex++; } res.ParseNodes(); return res; }
public static LogEntry State(Expression exp) { return new LogEntry("Captured expressions state.") { ExpressionState = exp }; }
public ListCache(Expression exp, Interpreter interpreter) : base(Void.Instance) { this.exp = exp; this.interpreter = interpreter; }
public CodeBlock(Expression expression) : base(ValueType.CodeBlock) { Expression = expression; }