ocaml-ppx / ocaml-migrate-parsetree

DEPRECATED. See https://ocaml.org/changelog/2023-10-23-omp-deprecation. Convert OCaml parsetrees between different major versions
Other
87 stars 43 forks source link

Ability to read any version of AST #78

Closed aantron closed 5 years ago

aantron commented 5 years ago

It would be useful for Bisect_ppx compiled on any OCaml version, to be able to read and write ASTs produced by any other OCaml version.

I think this is a sort of dual of current OMP functionality.

The context is that Bisect_ppx is now ported to BuckleScript, but during installation, BuckleScript is an NPM peer dependency of Bisect_ppx. This means that we can't guarantee that BuckleScript is installed first, so we can't detect its OCaml version number and use it for compiling the Bisect PPX with the same OCaml compiler. The current workaround for this is to constrain both the BuckleScript version and the OCaml version very specifically.

Ideally, we could generate one PPX, no matter which compiler compiled it, that can read any AST that is so far supported by OMP.

aantron commented 5 years ago

Looks like OMP already has machinery for this. Looking into whether this issue is valid.

let-def commented 5 years ago

Yes, the Ast_io module is doing just that.

aantron commented 5 years ago

The issue is that it's not being used in --as-ppx mode. I am switching to running the PPX as a standalone driver, but it looks like there will be other issues resulting from that.