You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's unclear how to use qasmparser if there are multiple strings or circuits to be parsed. In particular, parse has behaviour which is surprising to me. I expect each call to basically be independent and return a circuit based on the input string. What actually happens is parse builds on top of the circuit processed in previous calls.
In particular, it looks to me like this line is intended to clear the previous state, but is bugged because gates rather than self.gates is used.
Repro case:
from pyzx.circuit.qasmparser import QASMParser
s = """
OPENQASM 2;
include "qelib1.inc";
qreg q[1];
h q[0];
"""
p = QASMParser()
c1 = p.parse(s)
c2 = p.parse(s)
print(c1)
print(c1.gates)
print(c2)
print(c2.gates)
It's unclear how to use
qasmparser
if there are multiple strings or circuits to be parsed. In particular,parse
has behaviour which is surprising to me. I expect each call to basically be independent and return a circuit based on the input string. What actually happens isparse
builds on top of the circuit processed in previous calls.In particular, it looks to me like this line is intended to clear the previous state, but is bugged because
gates
rather thanself.gates
is used.Repro case:
Expected output:
Actual output:
In particular, it is surprising that a subsequent call to
parse
alters the value ofc1
.The text was updated successfully, but these errors were encountered: