Strict OpenQASM 3 export and N/M sidecar
Export a frozen OpenQASM 3.0 subset, verify syntax with the official reference grammar, and preserve N/M-only semantics in a versioned fail-closed sidecar.
OpenQASM 3 export 0.1 contract
Strict mode lowers extension gates into the published stdgates target, emits only the frozen carrier subset, escapes OpenQASM reserved identifiers, and returns machine-readable conformance and error evidence.
qubitbitstdgatesgphasemeasureresetbarrierifelseStrict subset, explicit exclusions
The carrier covers qubit/bit declarations, stdgates, global phase, measurement, reset, barrier, and if/else. Pulse calibration, defcal, timing, dynamic loops, and arbitrary classical computation are excluded.
Independent syntax conformance
Three curated strict fixtures, including all N/M gate families and classical control, are parsed by openqasm3.parser 1.0.1 generated from the official ANTLR reference grammar on the cross-platform CI matrix.
CLI carrier workflow
nm export main.nm --to qasm3 --strictnm export main.nm --to qasm3 --strict --jsonN/M sidecar 0.3 writer with permanent 0.1/0.2 readers
Sidecar 0.3 preserves N/M-only statements, the complete JSON IR, validated compile-time structure provenance, and generic-circuit specializations. Unknown fields, future versions, unknown statement kinds, projection tampering, and oversized inputs fail closed. Versions 0.1 and 0.2 remain readable; eligible documents migrate losslessly, while legacy structures without required provenance require source recompilation.
Stable export and sidecar diagnostics
Export source/training/empty/lowering/invariant failures and sidecar parse/type/format/version/unknown/limit/integrity failures have stable codes independent of prose.
NM-QASM3-EXPORT-001NM-QASM3-EXPORT-002NM-QASM3-EXPORT-003NM-QASM3-EXPORT-004NM-QASM3-EXPORT-005NM-QASM3-SIDECAR-PARSE-001NM-QASM3-SIDECAR-TYPE-001NM-QASM3-SIDECAR-FORMAT-001NM-QASM3-SIDECAR-VERSION-001NM-QASM3-SIDECAR-UNKNOWN-001NM-QASM3-SIDECAR-LIMIT-001NM-QASM3-SIDECAR-INTEGRITY-001Reference-parser success proves OpenQASM syntax, not semantic validity or provider acceptance. Generic OpenQASM consumers ignore N/M sidecar semantics; hardware support and include resolution remain provider responsibilities.
Core and CLI JSON carriers are byte-equivalent. A committed sidecar fixture round-trips exactly, hostile mutations fail closed, a reserved-word bug found by the external parser is covered by regression, and clean tarball consumers validate the same reader.