-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add reset to QASM parser #6710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add reset to QASM parser #6710
Conversation
f1f4288 to
be1a8a1
Compare
|
Rebased on top of main. |
44689b7 to
bfac925
Compare
a8cdb0b to
dc4dffa
Compare
|
Squashing everything into one commit after we finish review. Thus I leave the generic 'Fix comments & typos' as it is for now. |
Add a test which can serve as example including the modifications to support the `reset` keyword in the import of QASM files in the PLY based lexer/parser.
1332b34 to
9d2be2d
Compare
|
Hey guys, you have any feedback on the solution proposal here? |
natestemen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review doesn't mean much, since I'm not very familiar with this codebase, but the diff looks reasonable! Hope this can get reviewed by a cirq maintainer soon :)
|
It looks like there is an error in the parser:
Also, please run check/formatting in order to pass the format check. |
Hello everyone, is there anything remaining to address in this PR before it can be finalized? |
Strip leading indent from multi-line string. No change in effective code function.
No change in the test code.
|
@rscircus - thank you for contributing this and apologies for slow response. I have fixed the typo in parser definition and complaints from format checker. Please take a look if you are fine with the PR as is. LGTM from my POV. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6710 +/- ##
==========================================
- Coverage 97.85% 97.85% -0.01%
==========================================
Files 1084 1084
Lines 93742 93758 +16
==========================================
+ Hits 91733 91745 +12
- Misses 2009 2013 +4 ☔ View full report in Codecov by Sentry. |
|
Thanks. I'll pull at the weekend and give it a final run. |
I have merged, hope it is OK. LMK if you see anything amiss and we can address it in a follow-up PR. |
|
Thanks, @pavoljuhas |
Test parsing of `reset` with both OpenQASM 2.0 and 3.0. Fixes: quantumlib#6704 --------- Co-authored-by: Pavol Juhas <juhas@google.com>
This PR solves #6704
Note / 20240914:
After further inspection, I wonder why resets are implemented quite different to regular gates, despite following a somewhat similar terminology (
cirq.Rorcirq.reset) however, returning a ResetChannel. It appears to me that the reset is more similar to a measurement than compared to say a Hadamard gate.