Skip to main content

parse_qasm

Function parse_qasm 

Source
pub fn parse_qasm(input: &str) -> Result<QasmProgram, QasmError>
Expand description

Parses the supported OpenQASM 2 subset.

Supports the usual Clifford+T gates, exact pi/4 rotations, resets, Z measurements, barriers, and if (register == integer) controlled X/Y/Z. Nested conditions are allowed. Classical bits are single assignment and must have been measured before use in a condition. Custom gates, decimal angles, arbitrary includes, and conditional non-Pauli gates are unsupported. qelib1.inc gates are built in; includes never read the filesystem.

ยงErrors

Returns a QasmError for unsupported syntax, invalid registers, repeated classical assignments, or a condition reading an unmeasured bit. Register storage is bounded to 65,536 quantum and 65,536 classical entries. Conditions allow at most 63 bits per compared register and 64 total bit tests.