IntegerBinOp

Integer Binary Operation expression type. An expr node.

声明

语法

IntegerBinOp(expr left, binop op, expr right, ttype type, expr? value)

参数

left and right represent expression on the left and right side of operator op. type represents table entry type and value represents expression.

返回值

The return value is the expression that the IntegerBinOp represents.

描述

IntegerBinOp represents integer binary operation expression type. It is an ASR expr node. ASR has multiple binary expression types, for example: for Integer, real, complex, and logical.

If an binary expression is applying binary operator on integer operands, IntegerBinOp is called which then creates LFortran expression EXPR using, ASR::make_IntegerBinOp_t method call.

The binary operations accept two arguments of the same type. IntegerBinOp only accepts integers.

类型

Only accepts integers.

示例

Following example code creates LFortran expression from ASR’s IntegerBinOp:

(2+3)*5

ASR:

(TranslationUnit
    (SymbolTable
        1
        {

        })
    [(IntegerBinOp
        (IntegerBinOp
            (IntegerConstant 2 (Integer 4 []))
            Add
            (IntegerConstant 3 (Integer 4 []))
            (Integer 4 [])
            (IntegerConstant 5 (Integer 4 []))
        )
        Mul
        (IntegerConstant 5 (Integer 4 []))
        (Integer 4 [])
        (IntegerConstant 25 (Integer 4 []))
    )]
)

也可以看看

RealBinOp, ComplexBinOp, LogicalBinOp