RustPython / RustPython/Parser

A macro to generating AST with python grammar

未關閉
#55 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Rust
星號
117
分支
38
平均合併
4 天 7 小時
30 天內合併 PR
1

描述

Inspired by https://docs.rs/pmutil/latest/pmutil/macro.smart_quote.html

e.g.

ExprKind::Tuple(ast::ExprTuple {
    elts: names
        .iter()
        .map(|&name| {
            create_expr(ExprKind::Constant(
                ast::ExprConstant {
                    value: Constant::Str(name.to_string()),
                    kind: None,
                },
            ))
        })
        .collect(),
    ctx: ExprContext::Load,
}))

can be rewritten to:

&python_ast! {
    Vars { names },
    "(*names)"
}

The grammar will be limited to legal python codes to leverage python parser.

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先閱讀此 issue 中引用的 pmutil smart_quote 巨集,以及提議的 python_ast! 呼叫。在決定應如何限制 Python 文法之前,調查 RustPython/Parser 中的 parser 與 AST 產生入口點。完成的標準是,該巨集能將合法的 Python 程式碼片段與提供的 bindings 轉換成對應的 AST。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python, rust
領域
compilers
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。