Publish the parser as a standalone OCaml library
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 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
- 平均合併
- 19 小時 40 分鐘
- 30 天內合併 PR
- 54
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
rescript-lang/rescript 的其他 Issue
-
難度 5/5 一週以上 新手友好度 22/100
rescript-lang/rescript#8733 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
rescript-lang/rescript#8726 ·
維護者通常 1 天內回覆
-
Integer range patterns ending at 2147483647 generate incorrect JavaScript可能已有人在做 @fhammerschmidt 於 5 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 70/100
rescript-lang/rescript#8716 ·
維護者通常 1 天內回覆
-
Integer range patterns on record fields match values below the range可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 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 於 5 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 68/100
rescript-lang/rescript#8688 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 rescript-lang/rescript 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
lightpanda-io/browser#3852 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 65/100
hiero-ledger/hiero-sdk-js#4476 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 85/100
pytest-dev/pluggy#757 ·
維護者通常 1 天內回覆
-
status: team-only type: dependency-upgrade
難度 2/5 1-3 小時 新手友好度 66/100
spring-projects/spring-boot#52098 ·
維護者通常 1 天內回覆
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)可能已有人在做 @SelaseKay 今天認領。 未關閉Needs Attention type: enhancement
難度 2/5 1-3 小時 新手友好度 75/100
invertase/react-native-firebase#9364 · 1 則留言 ·
維護者通常 1 天內回覆