Rescript Compiler

Hi Team,

  1. I was exploring the rescript-compiler repo…I have a question regarding that can I get the CST/AST of a rescript file in JSON format?
  2. is there a way to use rescript-complier as a library in Ocaml?


The ReScript frontend is in jscomp/syntax/src, where it appears to be packaged as an internal dune library only (see dune file), which suggests to me that it is not currently setup to be easy to embed as a library. My hunch is that it would not be a lot of work to enable this use-case (make it a public-facing library and ensure that a .opam file exists or is generated for it).

If this syntax library was publicly available, you could use the res_core module to call the parser and get an AST, and then translate that to JSON.

I think that you should consider asking your question on the rescript-compiler repository directly.