Representation of a circuit in QASM (quantum assembly) format.

Please note that the QASM importer is in an experimental state and currently only supports a subset of the full OpenQASM spec. Amongst others, classical control, arbitrary gate definitions, and even some of the gates that don't have a one-to-one representation in Cirq, are not yet supported.

QASM output can be saved to a file using the save method.

operations Tree of operations to insert.
qubits The qubits used in the operations.
header A multi-line string that is placed in a comment at the top of the QASM.
precision The number of digits after the decimal to show for numbers in the QASM code.
version The QASM version to target. Objects may return different QASM depending on version.



View source

Test if id_str is a valid id in QASM grammar.


View source

Write QASM output to a file specified by path.

valid_id_re Instance of re.Pattern