1
$\begingroup$

A while ago I wrote an example of quantum teleportation circuit in the IBM Composer which ran fine as of three days ago. Yesterday, however, when I try to run the circuit, I get the following error:

Failed - QASM2ParseError: '<input>:27,1: needed a start-of-statement token, but instead got /

I am using the IBM Composer and not writing the OpenQASM 2.0 code directly, but of course the composer writes the code automatically. The line that seems to be causing a problem is at the end, and seems to be there due to using 'Freeform alignment' in the composer:

// @columns [0,1,1,1,3,4,5,5,5,6,7,8,8,8,9,10,11,12,13,14]

If I delete that line the code will run, but I lose the freeform alignment and hence visual organization in the composer. Is there a way to keep the freeform alignment line and still get working code?

$\endgroup$
2

1 Answer 1

0
$\begingroup$

According to Open Quantum Assembly Language by Cross et. la.

Comments begin with a pair of forward slashes and end with a new line.

Now, the line

// @columns [0,1,1,1,3,4,5,5,5,6,7,8,8,8,9,10,11,12,13,14]

is the last line in the OpenQasm panel. That is, it doesn't end with a new line. Which means that this error happens due to a bug in IBM Quantum Composer. As a workaround, just add an empty line after it, and your circuit should run without any issue.

$\endgroup$
1
  • $\begingroup$ Thanks, that seems to have been the problem! $\endgroup$ Commented Aug 26, 2023 at 17:31

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.