-
Notifications
You must be signed in to change notification settings - Fork 39
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
Slicing on classical registers #250
Comments
Are either of these supported by OpenQASM 3? Looking at the official grammar, it seems the slicing with
Regarding using aliasing with a classical register, it seems like valid syntax according to the grammar, but I noticed the OpenQASM 3 spec currently says (emphasis mine):
Notice that it doesn't say anything about classical registers. I'm not sure if I'm taking the (living) spec too literally, and I'm not trying to argue against supporting this, just my thoughts |
Exactly, it doesn't say anything about classical registers so the grammar becomes our only source of truth, thus the expression is valid if we're being logical. Specifically, it says "let keyword allows X" and not "let keyword only allows X". On top of that I think the correct reading is: "(quantum bits) and registers". From the common sense side, this should be supported. |
You're right, thanks for correcting my misunderstanding of the official grammar. However, I don't think the grammar in the qcor parser supports that: qcor/mlir/parsers/qasm3/antlr/qasm3.g4 Line 345 in 6f86835
So it seems to me like the grammar in this repository needs to be updated (which I assume will require updating the visitor that walks the parse tree, oh boy) |
I'm trying to write code in QASM 3 and this is the only compiler I found. I'm having problems with slicing classical registers as shown below:
gives me:
Am I doing something wrong?
Using let it seems that it somehow thinks is a qubit array:
gives me:
I don't know if I'm making something wrong or if there's an error in qcor.
The text was updated successfully, but these errors were encountered: