bloqade.squin.rewrite.qasm3.qasm3_expr_to_py.QASM3ExprToPy
← Module overview
class
method
source
classQASM3ExprToPy¶source
bloqade.squin.rewrite.qasm3.qasm3_expr_to_py.QASM3ExprToPy
Bases: RewriteRule
Rewrite QASM3 expression statements to their py/math dialect equivalents.
class QASM3ExprToPyThis mirrors the QASM2Py rewrite rule but for the QASM3 expression dialect.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
UNARY_OPS | dict[type[ir.Statement], type[ir.Statement]] | {expr.Neg: py.USub, expr.BitNot: py.Invert, expr.Sin: math.stmts.sin, expr.Cos: math.stmts.cos, expr.Tan: math.stmts.ta… | |
BINARY_OPS | dict[type[ir.Statement], type[ir.Statement]] | {expr.Add: py.Add, expr.Sub: py.Sub, expr.Mul: py.Mult, expr.Div: py.Div, expr.Pow: py.Pow, expr.Mod: py.Mod} |
methodrewrite_Statement¶source
bloqade.squin.rewrite.qasm3.qasm3_expr_to_py.QASM3ExprToPy.rewrite_Statement
def rewrite_Statement(node: ir.Statement) -> RewriteResultParameters
| Name | Type | Description |
|---|---|---|
node | ir.Statement |
Returns
RewriteResult