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

Modify the parser to make importing to Qiskit easier or possible #201

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

jlapeyre
Copy link
Collaborator

The parser no longer is expected to parse bogus gate definitions
from stdgates.inc. Rather, symbols are entered as if it had been
parsed. This requires modifying how the Qiskit importer works.

The main change here is implementing SymbolTable::gates. This
returns some information on all gates found in the symbol table.
Included is the minimal information required for the Qiskit importer
to map SymbolIds to Qiskit gates.

  • A smaller convenience:
    Add GateDeclaration::num_params() for convenience

Several other changes are noted in the git commit messages

  • Simplifying Expr::Identifier
  • Refactoring symbol lookup

The parser no longer is expected to parse bogus gate definitions
from stdgates.inc. Rather, symbols are entered as if it had been
parsed. This requires modifying how the Qiskit importer works.

The main change here is implementing `SymbolTable::gates`. This
returns some information on all gates found in the symbol table.
Included is the minimal information required for the Qiskit importer
to map `SymbolId`s to Qiskit gates.

* A smaller convenience:
  Add GateDeclaration::num_params() for convenience
As noted in a comment, having enum variants `Identifier(Identifier)`
where the field is a `struct Identifier` is not necessary, unless we
want to carry an extra copy of the name as a `String` for convenience.
This is a big price to pay for this convenience, which has not been used
for anything.

This commit removes `struct Identifier`. This also makes asg.rs more
consistent, since some of the variant already have the form `Identifier(SymbolIdResult)`
Looking up symbols has been refactored a bit. A method was added
that either returns an existing binding or makes a new one. It always
returns a `SymbolId` rather than a `Result<...>`.

This method will be used for hardware qubits.
The types of the fields of `Type::Gate` were changed to unsigned.
@jlapeyre jlapeyre merged commit e1c38cb into Qiskit:main Mar 27, 2024
7 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.

1 participant