public Value.Value resolve(Scope scope, Expression expression)
 {
     this.scope = scope;
     expression.accept(this);
     var result = evaluation.Peek();
     return result;
 }
Esempio n. 2
0
 public DivisionExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
Esempio n. 3
0
 public Condition(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
Esempio n. 4
0
 public BinaryExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token)
 {
     this.leftHandStatement = leftHandStatement;
     this.rightHandStatement = rightHandStatement;
 }
Esempio n. 5
0
 public MultiplyExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
Esempio n. 6
0
        static Expression produceExpression(Token token, Expression leftHandStatement, Expression rightHandStatement)
        {
            TokenType type = token.tokenType;
            switch (type)
            {
                case TokenType.ADD:
                    return new AdditionExpression(token, leftHandStatement, rightHandStatement);
                case TokenType.SUBTRACT:
                    return new SubtractExpression(token, leftHandStatement, rightHandStatement);
                case TokenType.MULTIPLY:
                    return new MultiplyExpression(token, leftHandStatement, rightHandStatement);
                case TokenType.DIVISION:
                    return new DivisionExpression(token, leftHandStatement, rightHandStatement);
                case TokenType.MODULO:
                    return new ModuloExpression(token, leftHandStatement, rightHandStatement);
                case TokenType.SMALLER:
                    return new SmallerCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.SMALLEREQUAL:
                    return new SmallerEqualCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.LARGER:
                    return new GreaterCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.LARGEREQUAL:
                    return new GreaterEqualCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.EQUAL:
                    return new EqualCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.NOTEQUAL:
                    return new NotEqualCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.AND:
                    return new AndCondition(token, leftHandStatement, rightHandStatement);
                case TokenType.OR:
                    return new OrCondition(token, leftHandStatement, rightHandStatement);
            }

            return null;
        }
Esempio n. 7
0
 public ReturnStatement(Expressions.Expression expression) : base(expression.token)
 {
     this.expression = expression;
 }
Esempio n. 8
0
 public Assignment(Identifier identifier, Expressions.Expression expression) : base(expression.token)
 {
     this.identifier = identifier;
     this.expression = expression;
 }
Esempio n. 9
0
 public SubtractExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }