SymbolicCompare¶
A comparison of two symbolic expressions.
Declaration¶
Syntax¶
SymbolicCompare(expr left, cmpop op, expr right, ttype type,
expr? value)
Arguments¶
Argument |
Description |
|---|---|
|
the left operand. |
|
the comparison; see cmpop. |
|
the right operand. |
|
the logical type of the result. |
|
the compile time value of the expression, when the frontend could fold it; |
Return values¶
The value of the expression.
Description¶
Symbolic expressions are LPython’s interface to a computer algebra system, and comparing two of them asks whether the expressions are equal as expressions, not whether they have equal numeric values.
Examples¶
(SymbolicCompare
:left (Var
:v (SymbolRef 1 "s")
)
:op :Eq
:right (Var
:v (SymbolRef 1 "s")
)
:type (Logical
:kind 4
)
:value nil
)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"main" (Program
:symtab (SymbolTable
:id 1
:symbols {
"p" (Variable
:parent_symtab 1
:name "p"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Logical
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"s" (Variable
:parent_symtab 1
:name "s"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (SymbolicExpression)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "main"
:dependencies []
:body [
(Assignment
:target (Var
:v (SymbolRef 1 "p")
)
:value (SymbolicCompare
:left (Var
:v (SymbolRef 1 "s")
)
:op :Eq
:right (Var
:v (SymbolRef 1 "s")
)
:type (Logical
:kind 4
)
:value nil
)
:overloaded nil
:realloc_lhs false
:move_allocation false
)
]
)
}
)
:items []
)