qbraid_qir.qasm3.qasm3_to_qir

qasm3_to_qir(program, name=None, **kwargs)[source]

Converts an OpenQASM 3 program to a PyQIR module.

Parameters:
  • program (openqasm3.ast.Program or str) – The OpenQASM 3 program to convert.

  • name (str, optional) – Identifier for created QIR module. Auto-generated if not provided.

Keyword Arguments:
  • initialize_runtime (bool) – Whether to perform quantum runtime environment initialization, default True.

  • record_output (bool) – Whether to record output calls for registers, default True

Return type:

Module

Returns:

The QIR pyqir.Module representation of the input OpenQASM 3 program.

Raises:
  • TypeError – If the input is not a valid OpenQASM 3 program.

  • Qasm3ConversionError – If the conversion fails.