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

Parser support for qasm3 qubits. #186

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

ScottWe
Copy link
Contributor

@ScottWe ScottWe commented Nov 25, 2024

Summary

This pull request allows parsing of OpenQASM 3 qubit declarations.

Details

In OpenQASM 2, a qubit array is declared using the qreg name[len]; statement, whereas in OpenQASM 3 the statement qubit[len] name is preferred. This pull request extends the QASMParser to support the qubit command.

Main Changes

  • Every [ symbol in each command is prefixed by a space. This ensures that the qubit in qubit[len] is disconnected from the designator [len].
  • The qreg parsing code has been factored out into QubitParser.
  • The QASMParser supports OpenQASM 3 qubit declarations.

Copy link
Collaborator

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

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

Great, thanks!

src/quartz/parser/qasm_parser.h Outdated Show resolved Hide resolved
src/quartz/parser/qasm_parser.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

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

Cool, thank you so much!

@xumingkuan xumingkuan merged commit ae382b5 into quantum-compiler:master Nov 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants