Closed wh5a closed 3 years ago
A statement like "cu1(-pi) q[0], q[1];" cannot be parsed correctly, unless we insert a space like so: "cu1(- pi) q[0], q[1];". This problem can be reproduced on https://quantum-circuit.com/ as well.
The antlr grammar needs to be changed. A quick search found some discussions: https://stackoverflow.com/questions/32166738/disambiguating-unary-and-binary-minus-in-antlr4-grammar https://stackoverflow.com/questions/27478834/how-compiler-distinguishes-minus-and-negative-number-during-parser-process
@wh5a thank you for reporting. Will be fixed asap. In meantime, you can use -1*pi instead -pi.
-1*pi
-pi
A statement like "cu1(-pi) q[0], q[1];" cannot be parsed correctly, unless we insert a space like so: "cu1(- pi) q[0], q[1];". This problem can be reproduced on https://quantum-circuit.com/ as well.
The antlr grammar needs to be changed. A quick search found some discussions: https://stackoverflow.com/questions/32166738/disambiguating-unary-and-binary-minus-in-antlr4-grammar https://stackoverflow.com/questions/27478834/how-compiler-distinguishes-minus-and-negative-number-during-parser-process