Skip to content

Preliminary support for parsing OpenQASM 3.0 #6797

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

Merged
merged 6 commits into from
Nov 20, 2024

Conversation

dstrain115
Copy link
Collaborator

  • This adjusts the lexer and parser to handle programs from OpenQASM 3.0.

- This adjusts the lexer and parser to handle programs
from OpenQASM 3.0.
@dstrain115 dstrain115 requested review from vtomole and a team as code owners November 18, 2024 01:50
@dstrain115 dstrain115 requested a review from maffoo November 18, 2024 01:50
@CirqBot CirqBot added the size: M 50< lines changed <250 label Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.85%. Comparing base (2991e80) to head (61ec695).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6797   +/-   ##
=======================================
  Coverage   97.85%   97.85%           
=======================================
  Files        1084     1084           
  Lines       93680    93715   +35     
=======================================
+ Hits        91671    91706   +35     
  Misses       2009     2009           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@@ -315,13 +322,19 @@ def p_circuit_empty(self, p):

def p_new_reg(self, p):
"""new_reg : QREG ID '[' NATURAL_NUMBER ']' ';'
| CREG ID '[' NATURAL_NUMBER ']' ';'"""
name, length = p[2], p[4]
| QUBIT '[' NATURAL_NUMBER ']' ID ';'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenQASM 3 seems to allow scalar qubits defined as qubit some_name;.

Would it be feasible to handle it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added scalar qubits (and bits)

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please see the inline question.

@dstrain115 dstrain115 enabled auto-merge (squash) November 20, 2024 14:36
@dstrain115 dstrain115 merged commit 02f2f84 into quantumlib:main Nov 20, 2024
37 checks passed
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
* Preliminary support for parsing OpenQASM 3.0

- This adjusts the lexer and parser to handle programs from OpenQASM 3.0.
- This also adds the capability for scalar qubits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants