app.processing.pre.io_parser

Parse input/output info for single code snippet over leqo-annotations.

Module Contents

class app.processing.pre.io_parser.ParseAnnotationsVisitor(io: app.processing.graph.IOInfo, qubit: app.processing.graph.QubitInfo)

Non-modifying visitor to parse leqo annotations.

Parameters:
get_declaration_annotation_info(name: str, annotations: list[openqasm3.ast.Annotation]) tuple[int | None, bool]

Extract annotation info for declaration, throw error on bad usage.

Parameters:
Return type:

tuple[int | None, bool]

get_alias_annotation_info(name: str, annotations: list[openqasm3.ast.Annotation]) tuple[int | None, bool]

Extract annotation info for alias, throw error on bad usage.

Parameters:
Return type:

tuple[int | None, bool]

get_branching_annotation_info(annotations: list[openqasm3.ast.Annotation]) bool

Extract annotation info for branching statement, throw error on bad usage.

Parameters:

annotations (list[openqasm3.ast.Annotation])

Return type:

bool

visit_QubitDeclaration(node: openqasm3.ast.QubitDeclaration) openqasm3.ast.QASMNode

Parse qubit-declarations and their corresponding input/dirty annotations.

Parameters:

node (openqasm3.ast.QubitDeclaration)

Return type:

openqasm3.ast.QASMNode

visit_ClassicalDeclaration(node: openqasm3.ast.ClassicalDeclaration) openqasm3.ast.QASMNode

Parse classical-declarations and their corresponding input annotations.

Parameters:

node (openqasm3.ast.ClassicalDeclaration)

Return type:

openqasm3.ast.QASMNode

visit_AliasStatement(node: openqasm3.ast.AliasStatement) openqasm3.ast.QASMNode

Parse alias and their corresponding output/reusalbe annotations.

Parameters:

node (openqasm3.ast.AliasStatement)

Return type:

openqasm3.ast.QASMNode

visit_BranchingStatement(node: openqasm3.ast.BranchingStatement) openqasm3.ast.QASMNode

Parse if-then-else-block and their corresponding uncompute annotations.

Parameters:

node (openqasm3.ast.BranchingStatement)

Return type:

openqasm3.ast.QASMNode

static raise_on_non_contiguous_range(numbers: set[int], name_of_check: str) None

Check if int-set is contiguous and starting from 0.

Parameters:
Return type:

None

visit_Program(node: openqasm3.ast.Program) openqasm3.ast.QASMNode

Ensure contiguous input/output indexes and compute returned-dirty qubits.

Parameters:

node (openqasm3.ast.Program)

Return type:

openqasm3.ast.QASMNode