Skip to content

[FEATURE] Add custom include file support #113

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

Open
TheGupta2012 opened this issue Dec 14, 2024 · 0 comments
Open

[FEATURE] Add custom include file support #113

TheGupta2012 opened this issue Dec 14, 2024 · 0 comments
Labels
enhancement New feature or request qasm3 Related to openqasm3

Comments

@TheGupta2012
Copy link
Member

TheGupta2012 commented Dec 14, 2024

Feature Description

We want users to be able to add include files other than stdgates.inc and qelib1.inc in qasm code.

The primary motivation for this feature came out of the integration with qBraid SDK's IONQ component. IONQ supports multiple definitions of the ms gate with 2 or 3 parameters but multiple gate definitions are not supported by openqasm.

With this feature, we will be able to specify something like a ionqnative.inc file containing custom gate definitions. If the gate names are same as those identified by pyqasm, the explicitly supplied definitions will take precedence.

Implementation (Optional)

Design Question

  • We will need to see if there is an option to switch parser context with include files. This will enable us to just point the parser to the new include file code and continue the parsing as before. But the error reporting would be little tricky as we will have to manage something like a "file context" to know where we are at (and in which file).

  • If not above, we can also add a preprocessing step for the analyser which will make 1 big file containing all the includes and then start the analysis.

Reference : https://openqasm.com/language/comments.html#included-files

@TheGupta2012 TheGupta2012 added enhancement New feature or request qasm3 Related to openqasm3 labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request qasm3 Related to openqasm3
Projects
None yet
Development

No branches or pull requests

1 participant