pyqasm.loads

loads(program)[source]

Loads an OpenQASM program into a QasmModule object.

Parameters:

program (openqasm3.ast.Program or str) – The OpenQASM program to validate.

Raises:
  • TypeError – If the input is not a string or an openqasm3.ast.Program instance.

  • ValidationError – If the program fails parsing or semantic validation.

Returns:

An object containing the parsed qasm representation along with

some useful metadata and methods

Return type:

QasmModule