Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Investigate `lark` as an alternative to `antlr4-python3-runtime` in `openqasm3.parser`

オープン
#196 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
compilers

調査の方向性

The work centers on parser.py in the OpenQASM3 repository, where the current ANTLR-based parser lives, and the target is a Lark grammar covering a small subset of statements and gate definitions. Start by mapping the parser's entry points and how it emits AST nodes, then sketch the Lark grammar and a Transformer. Done means a prototype that yields identical objects and error messages on sample files, plus a written benchmark against the original parser.

索引モデルが issue の本文から書いたものです。

説明

enhancement optimization

Background

The current OpenQASM3 parser is a known performance bottleneck, especially for large or complex QASM files. Rather than a full migration, this issue proposes a focused experiment: fork the repo, implement a Lark-based parser in parser.py for a subset of the grammar, and evaluate feasibility, performance, and compatibility.

Goals

  • Evaluate if Lark can serve as a drop-in replacement for the current parser logic.
  • Maintain API and object compatibility with existing code.
  • Benchmark correctness and performance on OpenQASM3 files.

Proposed Steps

1. Fork and Prepare
2. Analyze parser.py
  • Identify key functions/classes responsible for:
    • Parsing input strings/files
    • Emitting AST or domain objects
    • Error handling and reporting
3. Develop Lark Grammar
  • Extract a minimal but representative subset of the OpenQASM3 grammar (e.g., statements, declarations, a few gate definitions).
  • Write the equivalent Lark EBNF grammar.
4. Implement Lark Parser
  • In parser.py, add a new parser class or function using Lark.
  • Use a Transformer to convert the Lark parse tree into the same AST or objects as the current parser.
  • Add a feature flag or environment variable to switch between the old and new parsers for testing.
5. Ensure API Compatibility
  • Match all public methods, return types, and error messages to the existing API.
  • Write or adapt unit tests to verify that the Lark-based parser produces identical results.
6. Benchmark and Report
  • Compare parsing speed and memory usage between the original and Lark-based parser.
  • Document any edge cases, limitations, or incompatibilities encountered.
7. Share Findings
  • Summarize results in a markdown file or GitHub issue.
  • If successful, outline next steps for incremental migration.
  • Eventually, we want this change to be merged upstream into openqasm3 if the maintainers are willing. If not, we can merge this as a parser component within pyqasm itself.

References

主要言語
Python
スター
29
フォーク
33
平均マージ
2日 4時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

qBraid/pyqasm のほかの issue

qBraid/pyqasm の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。