Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[FEATURE] Add support for `pragma`

Aperta
#8 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

Start with the Qasm3Module class in src/pyqasm/modules/qasm3.py, where the parsed program state would hold the new read-only pragma mapping, and read the OpenQASM directives page linked in the issue to confirm the pragma syntax. The open decisions are the identifier schema (__device_name__, __device_native_gates__, and so on) and whether unknown pragmas are ignored or stored, so the maintainers need to settle these before code is written. Done means pragma key/value pairs are parsed into a MappingProxyType on the module and can be read back, with tests for known and unknown keys.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement qasm3 qasm3-coverage
Feature Description
  • Add support for pragma in openqasm
  • Motivation: Adding pragma compiler directives enables more granular optimization for specific programs. Eg. we can embed the device information in the openqasm program itself enabling target specific transformations / optimizations for an openqasm compiler.
Implementation (Optional)
  • Since the structure of #pragma annotations are left for the compiler to handle, we can use key value pairs such as -
pragma __device_name__ : "simulator_1" 
pragma __device_native_gates__ : { "h", "cx", "s", "t" }
  • We can have a list of predefined pragma identifiers such as __device_name__, __native_gate_set__, __device_qubits__, and so on, with a specified value schema. Following is a good place to start -

    • __device_name__ : string
    • __device_num_qubits__ : string
    • __device_native_gates__ : set of string
    • __device_architecture__ : string
  • Any other pragma values are ignored OR optionally stored as key value pairs without parsing the value further

  • These values can be stored using the MappingProxyType ( as an immutable dict ), inside the Qasm3Module objects and retrieved as required.

Lingua principale
Python
Stelle
29
Fork
33
Merge medio
2g 4h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qBraid/pyqasm

Tutte le issue di qBraid/pyqasm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.