Example #1
0
 public Interpreter(Expression expression)
 {
     scopeStack = new Stack<ScopeTreeNode>();
     ScopeTreeRoot = new ScopeTreeNode(Permanency.Permanent);
     RootExpression = expression;
     Log = new List<LogEntry>();
 }
Example #2
0
        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;
        }
Example #3
0
 public static LogEntry State(Expression exp)
 {
     return new LogEntry("Captured expressions state.") { ExpressionState = exp };
 }
Example #4
0
 public ListCache(Expression exp, Interpreter interpreter)
     : base(Void.Instance)
 {
     this.exp = exp;
     this.interpreter = interpreter;
 }
Example #5
0
 public CodeBlock(Expression expression)
     : base(ValueType.CodeBlock)
 {
     Expression = expression;
 }