Publish the parser as a standalone OCaml library
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- ocaml
- 領域
- build-system
調査の方向性
Start by reading the dune graph and the listed blocker issues #8567 and #8624, then trace the parser’s dependency closure with ocamldep. The proposed work spans AST boundaries, dependencies, namespacing, global state, C stubs, packaging, and CI, so it is not a small standalone change. Done means a clean-switch dune build -p rescript-syntax succeeds with only ocaml and dune dependencies.
索引モデルが issue の本文から書いたものです。
説明
Goal
Publish the ReScript parser/printer as a reusable OCaml library that needs only ocaml and dune.
Current state
The dune graph is syntax → ml → {ext, flow_parser}. flow_parser is the only part with heavy OPAM dependencies (ppxlib, ppx_deriving, ppx_gen_rec, wtf8, plus a vendored sedlex ppx). The parser pulls all of them in.
Transitive module closure of Res_core / Res_printer / Res_driver (via ocamldep):
| library | modules reached |
|---|---|
syntax/src |
16 / 24 |
ml |
~18 / 91 |
ext |
20 / 66 |
flow_parser |
27 / 27 |
The parser needs only a small part of ml/ext. A few edges drag in the rest.
Blockers
- The AST layer depends on the Flow JS parser.
ml/ast_payload.mlcallsParser_flowandClassify_functionto classify%rawpayloads.ml/ast_helper.mlusesAst_payload, so the plain AST builder depends onflow_parser.- Related: #8567 (replacing/vendoring the Flow parser). This issue needs Flow out of the parser's dependency closure either way.
- Compiler semantics live in
Parsetree.Prim_ffi of {spec: External_ffi_types.t}andPrim_inline_consttie the syntax tree to FFI/codegen types. Tracked in #8624 (section C / step B). - No library boundary.
syntaxdepends on all ofml(the type checker). - No namespacing. All libraries are
(wrapped false). Module names clash withcompiler-libs/ ppxlib (Location,Misc,Warnings,Ident,Parsetree,Asttypes,Longident,Ast_helper,Printast,Pprintast) and are generic (Literals,Map_gen,Identifiable). - Global mutable state.
Location→Clflags/Warnings/Misc. Diagnostics go through global refs, stderr and exceptions. - C stubs and build profiles.
exthas C stubs reachable from the parser (Ext_platform_primitives). Native vs. playground behavior is chosen with thebrowserprofile and copy rules instead ofselector virtual libraries.
Proposed plan
- Split
Ast_payloadinto a pure payload-inspection part and a%raw/%reclassification part. Move the classification tofrontend/core, and makeAst_helperflow-free. This alone drops ppxlib/ppx_deriving/ppx_gen_rec/wtf8 from the parser. - Move
Prim_ffi/Prim_inline_constout of the parsetree (see #8624). - Extract a small
rescript_astlibrary (Parsetree, Asttypes, Longident, Location, Ast_helper, pure Ast_payload, neededexthelpers). Makesyntaxdepend on it instead ofml. Decide wherejsx_ppxandRes_outcome_printer(Outcometree) go. - Make the AST library free of C stubs, or give it a pure-OCaml fallback, so it works under js_of_ocaml without a custom profile.
- Wrap the published libraries (
(wrapped true)or(wrapped (transition …))). - Expose a parser API that returns diagnostics and takes explicit config instead of relying on global state.
- Add an opam package (e.g.
rescript-syntax) withpublic_names. Its only dependencies should beocamlanddune. - Align with #8624 (parsetree v1) for API/AST stability.
- Confirm licensing for the package: compiler-derived files are LGPL with the OCaml linking exception.
- Add a CI job that builds the package alone in a clean switch (
dune build -p rescript-syntax) to catch dependency regressions.
- 主要言語
- OCaml
- スター
- 7.5k
- フォーク
- 485
- 平均マージ
- 21時間 51分
- マージ済み PR(30日)
- 53
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rescript-lang/rescript のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
rescript-lang/rescript#8733 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#8726 ·
メンテナーはふだん 1 日以内に返信
-
Integer range patterns ending at 2147483647 generate incorrect JavaScript対応中かも @fhammerschmidt が 4 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
rescript-lang/rescript#8716 ·
メンテナーはふだん 1 日以内に返信
-
Integer range patterns on record fields match values below the range対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
rescript-lang/rescript#8713 ·
メンテナーはふだん 1 日以内に返信
-
A regex literal that starts a statement is parsed as division, and the formatter removes the parentheses that prevent it対応中かも @fhammerschmidt が 4 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
rescript-lang/rescript#8688 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
rescript-lang/rescript の issue をすべて見る
似ている issue
-
難易度 2/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
qt6base报错オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
coolsnowwolf/lede#14208 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ipython/ipython#15422 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
sev:L
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Systemorph/MeshWeaver#6233 ·
メンテナーはふだん 1 日以内に返信