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