Skip to content
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

[BUG] Handle opaque in parsing qasm2 strings #54

Open
TheGupta2012 opened this issue Oct 29, 2024 · 0 comments
Open

[BUG] Handle opaque in parsing qasm2 strings #54

TheGupta2012 opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working qasm2 Related to openqasm2

Comments

@TheGupta2012
Copy link
Contributor

Environment

  • PyQASM version: 0.0.2
  • Python version: 3.11.6
  • Operating system: macOS 14.4

What happened?

PyQASM should gracefully parse the opaque identifier -

ValidationError           Traceback (most recent call last)
Cell In[6], line 1
----> 1 mod = pyqasm.load("""
      2 OPENQASM 2.0;
      3 include "qelib1.inc";
      4 qreg q[2];
      5 creg c[2];
      6 opaque custom_gate (a,b,c) p,q,r;""")

File ~/Desktop/qBraid/repos/pyqasm/pyqasm/entrypoint.py:47, in load(program)
     45         program = openqasm3.parse(program)
     46     except openqasm3.parser.QASM3ParsingError as err:
---> 47         raise ValidationError(f"Failed to parse OpenQASM string: {err}") from err
     48 elif not isinstance(program, openqasm3.ast.Program):
     49     raise TypeError("Input quantum program must be of type 'str' or 'openqasm3.ast.Program'.")

ValidationError: Failed to parse OpenQASM string:

Suggestions (Optional)

Handle opaque in the visitor

@TheGupta2012 TheGupta2012 added bug Something isn't working qasm2 Related to openqasm2 labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working qasm2 Related to openqasm2
Projects
None yet
Development

No branches or pull requests

1 participant