Add OpenQASM 3 import for GateCircuit#24
Merged
Conversation
Member
Member
|
Thanks @Kitsunp, we're going with this one for #14. It's clean, dependency-free, and the best-validated of the parsers here (strict OPENQASM 3; header, arity and duplicate-qubit checks, parametric rejection, and round-trip circuit_unitary tests), which fits our goal of keeping Stretto's core lean for the public release. Verified locally: 123/123 passing. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14
Summary
This PR adds a minimal OpenQASM 3 importer for Stretto circuits.
It introduces
from_qasm(qasm::String) -> GateCircuit, which parses a small static OpenQASM 3 subset into Stretto's existingGateCircuit/GateOprepresentation.Changes
src/qasm.jlwithfrom_qasm.h -> :Hcx -> :CXcz -> :CZx -> :Xy -> :Yz -> :Zs -> :St -> :Tccx -> :CCXinclude "..."statements and compact one-line QASM statements.measurefrom_qasmfromStretto.qasm.jlto the API documentation.Scope
This intentionally implements only the static OpenQASM 3 subset requested in the issue. It does not add parametric gates, OpenQASM 2 support,
to_qasm, Python interop, or new compilation behavior.Verification
Result:
Result:
The docs build still reports existing warnings for unrelated links/docstrings.
AI Transparency
I used OpenAI Codex to help inspect the repository patterns, compare the implementation against issue #14, draft tests, and run local verification. I manually reviewed the parser behavior, supported scope, error handling, tests, documentation changes, and command outputs before preparing this PR.