| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | open Declarations |
| 12 | open Mod_declarations |
| 13 | open Environ |
| 14 | open Entries |
| 15 | open Mod_subst |
| 16 | open Names |
| 17 | |
| 18 | (** Main functions for translating module entries *) |
| 19 | |
| 20 | type 'a vm_handler = { vm_handler : env -> universes -> Constr.t -> 'a -> 'a * Vmlibrary.indirect_code option } |
| 21 | type 'a vm_state = 'a * 'a vm_handler |
| 22 | |
| 23 | (** [translate_module] produces a [module_body] out of a [module_entry]. |
| 24 | In the output fields: |
| 25 | - [mod_expr] is [Abstract] for a [MType] entry, or [Algebraic] for [MExpr]. |
| 26 | - [mod_type_alg] is [None] only for a [MExpr] without explicit signature. |
| 27 | *) |
| 28 | |
| 29 | val translate_module : |
| 30 | ('a, Conversion.graph_inconsistency) Conversion.universe_state -> |
| 31 | 'b vm_state -> |
| 32 | env -> ModPath.t -> inline -> module_entry -> module_body * 'a * 'b |
| 33 | |
| 34 | (** [translate_modtype] produces a [module_type_body] whose [mod_type_alg] |
| 35 | cannot be [None] (and of course [mod_expr] is [Abstract]). *) |
| 36 | |
| 37 | val translate_modtype : |
| 38 | ('a, Conversion.graph_inconsistency) Conversion.universe_state -> |
| 39 | 'b vm_state -> |
| 40 | env -> ModPath.t -> inline -> module_type_entry -> module_type_body * 'a * 'b |
| 41 | |
| 42 | (** From an already-translated (or interactive) implementation and |
| 43 | an (optional) signature entry, produces a final [module_body] *) |
| 44 | |
| 45 | val finalize_module : |
| 46 | ('a, Conversion.graph_inconsistency) Conversion.universe_state -> |
| 47 | 'b vm_state -> |
| 48 | env -> ModPath.t -> module_signature * delta_resolver -> |
| 49 | (module_type_entry * inline) option -> |
| 50 | module_body * 'a * 'b |
| 51 | |
| 52 | (** [translate_mse_incl] translate the mse of a module or |
| 53 | module type given to an Include *) |
| 54 | |
| 55 | val translate_mse_include : |
| 56 | bool -> ('a, Conversion.graph_inconsistency) Conversion.universe_state -> 'b vm_state -> Environ.env -> ModPath.t -> inline -> |
| 57 | module_struct_entry -> module_signature * unit * delta_resolver * 'a * 'b |