Skip to content

[FEATURE] Add custom include file support  #113

@TheGupta2012

Description

@TheGupta2012

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestqasm3Related to openqasm3

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions