Update the included OpenQASM grammar to OpenQASM 3.1.0#24
Update the included OpenQASM grammar to OpenQASM 3.1.0#24braised-babbage merged 13 commits intoopenqasm:mainfrom
Conversation
|
Tests pass for me with the main branch of the https://github.com/openqasm/openqasm/ repository but we'll probably need a new release before they pass here. |
|
@braised-babbage Would you mind having a very brief look at this and letting me know if there is anything obviously missing from it? E.g. Should tests be added for the new OpenQASM 3.1 features? |
There was a problem hiding this comment.
I took a look at this. A few thoughts
- I ran our internal regression tests on this, using the
openqasm3v1.0 release. Everything passed (but note that these tests do not use OpenQASM 3.1 language features). - I think we should update
src/openpulse/ANTLR_VERSIONS.txtto cover more recent versions supported byopenqasm3(see this list) - Yes, I think it makes sense to add tests for new language features. I tried one for
switchwithin acalblock and can see that it doesn't quite work yet:
parsing
const int A = 0;
cal {
int x = 10;
switch (x) {
case 1, 3, 5 {
x += 1;
}
case 2, 4, 6 {
x += 1;
x *= 2;
}
case A {
}
default {
}
}
}
and then printing this out (openpulse.printer.dumps) gives
const int A = 0;
cal {
int x = 10;
}
This makes sense, given that there is no switchStatement option for openpulseStatement (in source/grammar/openpulseParser.g4). It's kind of annoying that these failures are silent though.
I suppose a part of the discussion around (3) is whether we should generally push new OpenQASM features into OpenPulse (to be usable within a cal block). I think for classical types & control flow, the answer should be yes -- OpenPulse is intended to be an extension of OpenQASM in this respect, and I can imagine something like switch being useful at a pulse level.
|
@braised-babbage Would you mind doing another review? Outstanding questions:
|
Looks good to me. Thanks for doing this. Re: the
Note that some of the above PRs fail in CI because the current constraint on |
That's strange -- your guess is as good as mine. |
|
@braised-babbage Tests passing! |
braised-babbage
left a comment
There was a problem hiding this comment.
Looks good to me
No description provided.