Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Publish the parser as a standalone OCaml library

Ouverte
#8,727 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
ocaml
Domaine
build-system

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

  1. The AST layer depends on the Flow JS parser.
    • ml/ast_payload.ml calls Parser_flow and Classify_function to classify %raw payloads.
    • ml/ast_helper.ml uses Ast_payload, so the plain AST builder depends on flow_parser.
    • Related: #8567 (replacing/vendoring the Flow parser). This issue needs Flow out of the parser's dependency closure either way.
  2. Compiler semantics live in Parsetree. Prim_ffi of {spec: External_ffi_types.t} and Prim_inline_const tie the syntax tree to FFI/codegen types. Tracked in #8624 (section C / step B).
  3. No library boundary. syntax depends on all of ml (the type checker).
  4. No namespacing. All libraries are (wrapped false). Module names clash with compiler-libs / ppxlib (Location, Misc, Warnings, Ident, Parsetree, Asttypes, Longident, Ast_helper, Printast, Pprintast) and are generic (Literals, Map_gen, Identifiable).
  5. Global mutable state. Location → Clflags / Warnings / Misc. Diagnostics go through global refs, stderr and exceptions.
  6. C stubs and build profiles. ext has C stubs reachable from the parser (Ext_platform_primitives). Native vs. playground behavior is chosen with the browser profile and copy rules instead of select or virtual libraries.

Proposed plan

  • Split Ast_payload into a pure payload-inspection part and a %raw/%re classification part. Move the classification to frontend/core, and make Ast_helper flow-free. This alone drops ppxlib/ppx_deriving/ppx_gen_rec/wtf8 from the parser.
  • Move Prim_ffi / Prim_inline_const out of the parsetree (see #8624).
  • Extract a small rescript_ast library (Parsetree, Asttypes, Longident, Location, Ast_helper, pure Ast_payload, needed ext helpers). Make syntax depend on it instead of ml. Decide where jsx_ppx and Res_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) with public_names. Its only dependencies should be ocaml and dune.
  • 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.
Langage dominant
OCaml
Étoiles
7.5k
Forks
485
Merge moyen
21 h 51 min
PR mergées (30 j)
53

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de rescript-lang/rescript

Toutes les issues de rescript-lang/rescript

Issues similaires

Plus d'issues Build System

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.