app.enricher.utils

Utils for generating implementations for a Node in an EnricherStrategy.

Module Contents

app.enricher.utils.implementation(node: app.model.CompileRequest.Node, statements: collections.abc.Sequence[openqasm3.ast.Statement | openqasm3.ast.Pragma]) app.enricher.ParsedImplementationNode

Creates an ImplementationNode from partial syntax tree.

Parameters:
Return type:

app.enricher.ParsedImplementationNode

app.enricher.utils.leqo_input(name: str, index: int, size: int | None, *, twos_complement: bool = False) openqasm3.ast.QubitDeclaration

Creates a qubit input declaration.

Parameters:
  • name (str) – Identifier of the input declaration

  • index (int) – Index of the input

  • size (int | None) – Size of the input (in qubits)

  • twos_complement (bool) – Whether the input is interpreted as two’s complement.

Return type:

openqasm3.ast.QubitDeclaration

app.enricher.utils.leqo_output(name: str, index: int, value: AliasableExpression) openqasm3.ast.AliasStatement

Creates an output declaration.

Parameters:
  • name (str) – Identifier of the output declaration

  • index (int) – Index of the output

  • value (AliasableExpression) – Openqasm3 construct that should be the output

Return type:

openqasm3.ast.AliasStatement