public Value.Value resolve(Scope scope, Expression expression)
 {
     this.scope = scope;
     expression.accept(this);
     var result = evaluation.Peek();
     return result;
 }
 public DivisionExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
示例#3
0
 public Condition(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
示例#4
0
 public BinaryExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token)
 {
     this.leftHandStatement = leftHandStatement;
     this.rightHandStatement = rightHandStatement;
 }
 public MultiplyExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }
示例#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;
        }
示例#7
0
 public ReturnStatement(Expressions.Expression expression) : base(expression.token)
 {
     this.expression = expression;
 }
示例#8
0
 public Assignment(Identifier identifier, Expressions.Expression expression) : base(expression.token)
 {
     this.identifier = identifier;
     this.expression = expression;
 }
 public SubtractExpression(Token token, Expression leftHandStatement, Expression rightHandStatement) : base(token, leftHandStatement, rightHandStatement)
 {
 }