package ocaml-migrate-parsetree

  1. Overview
  2. Docs
Convert OCaml parsetrees between different versions

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-migrate-parsetree-v1.4.0.tbz
sha256=231fbdc205187b3ee266b535d9cfe44b599067b2f6e97883c782ea7bb577d3b8
sha512=61ee91d2d146cc2d2ff2d5dc4ef5dea4dc4d3c8dbd8b4c9586d64b6ad7302327ab35547aa0a5b0103c3f07b66b13d416a1bee6d4d117293cd3cabe44113ec6d4

doc/ocaml-migrate-parsetree/Migrate_parsetree_ast_io/index.html

Module Migrate_parsetree_ast_io

  • deprecated Access modules via the Migrate_parsetree toplevel module. Use Migrate_parsetree.Migrate_parsetree_ast_io instead.
type ast =
  1. | Impl : (module Migrate_parsetree__.Migrate_parsetree_versions.OCaml_version with type Ast.Parsetree.structure = 'concrete) * 'concrete -> ast
  2. | Intf : (module Migrate_parsetree__.Migrate_parsetree_versions.OCaml_version with type Ast.Parsetree.signature = 'concrete) * 'concrete -> ast

A marshalled ast packs the ast with the corresponding version of the frontend

type filename = string

A simple alias used for the filename of the source that produced an AST

type read_error =
  1. | Not_a_binary_ast of string
    (*

    The input doesn't contain a binary AST. The argument corresponds to the bytes from the input that were consumed.

    *)
  2. | Unknown_version of string
    (*

    The input contains a binary AST for an unknown version of OCaml. The argument is the unknown magic number.

    *)
val from_channel : in_channel -> (filename * ast, read_error) Result.result

Load a marshalled AST from a channel

Any exception raised during unmarshalling (see Marshal) can escape.

val from_bytes : bytes -> int -> (filename * ast, read_error) Result.result

Load a marshalled AST from a byte string.

See from_channel description for exception that can be raised.

val to_channel : out_channel -> filename -> ast -> unit

Marshal an AST to a channel

val to_bytes : filename -> ast -> bytes

Marshal an AST to a byte string

OCaml

Innovation. Community. Security.