Closed moar55 closed 3 years ago
Would such syntax be also valid:
qubit [4] q1, q2[3]
@amccaskey
Good question. My initial thought is no. You should be consistent in single line comma separated declarations. In the case you specify, I think qubit[4] implies a specific type (namely an array of 4 qubits) and that should be for all variables in the comma separated declaration.
sounds good 👍
I also think allowing both kind of declarations for qreg would make the grammar and the implementation simpler. Given that we are not planning to adhere exactly to the openqasm 3 grammar.
So have both:
qreg[4] q0;
and
qreg q0[4];
.
It is obvious why this would make the grammar simpler. Regarding the implementation I either have to make two visitors or have a single visitor with and std::variant
identifier list vector(one variant for 'qubit' identifier list and the other for 'qreg' identifier list). The former approach fees like an overkill and the latter wouldn't be so clean. Atleast these are the implementations that I have in mind... What do you think? @amccaskey
This pull request conforms QASM3-MLIR conversions of quantum declarations with the latest QASM3 grammar. Relevant to #190