-
Notifications
You must be signed in to change notification settings - Fork 9
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
Update the included OpenQASM grammar to OpenQASM 3.1.0 #24
Update the included OpenQASM grammar to OpenQASM 3.1.0 #24
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at this. A few thoughts
- I ran our internal regression tests on this, using the
openqasm3
v1.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.txt
to 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
switch
within acal
block 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! |
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.
Looks good to me
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.
Nice idea
No description provided.