6
$\begingroup$

I have gotten conflicting information about OpenQASM; some sources point to version 3 while others say 3 is not ready. I want to refer to a document that will tell me what instructions actually work with the official library.

$\endgroup$

1 Answer 1

4
$\begingroup$

OpenQASM 2 is defined by https://arxiv.org/abs/1707.03429 It may focus is to describe a gate-based quantum circuit. There are several examples here on what it can be done with it. There are several parsers for OpenQASM 2 (for example: in Qiskit and NuQasm2.

  • Pro: stable and well-supported by many tools.
  • Con: Not very expressive. Some use-cases cannot be written in 2.0

OpenQASM 3 is live document in https://qiskit.github.io/openqasm/ . The broad document that govern many of the design decisions is https://arxiv.org/abs/2104.14722 . The detailed specification is currently work-in-progress that is open for participation here. A reference parser is being written as part of the same effort.

  • Pro: More complete language with classical support.
  • Con: Some aspects of it are in active discussion and might change quickly.

TL;DR Depending on your goal and focus, OpenQASM 2 might be enough. If you need classical computing support, inputs, or other feature not covered by OpenQASM 2, you will need OpenQASM 3. In the last case, keeping an eye on the last changes might be important.

$\endgroup$
4
  • $\begingroup$ I know 3.0 is a live specification; my question is whether it actually works. The code I tried wouldn't compile $\endgroup$
    – Anna Naden
    Dec 6, 2021 at 22:40
  • $\begingroup$ You mean, the parser did not work? $\endgroup$
    – luciano
    Dec 7, 2021 at 17:02
  • $\begingroup$ It rejected curly braces and also references like q[0] where q is a quantum register. Do I need to download source code and build? I just passed my qasm3 code to the backend as a string. It works for qasm2 but not for qasm3 $\endgroup$
    – Anna Naden
    Dec 8, 2021 at 18:40
  • $\begingroup$ What's "it"? I don't know what a backend is in this context. Maybe ask for help in #open-qasm slack channel join.slack.com/share/… $\endgroup$
    – luciano
    Dec 9, 2021 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.