Module Imandra_codegen

Code Generation for (de)serializers

This module provides serialization/deserialization for all types defined in logic mode.

module Serde_yojson : sig ... end
module Gen_pp : sig ... end
module Gen_json : sig ... end
module Gen_rand : sig ... end
module Gen_finite_type : sig ... end
type t
val make : ?timestamp:bool -> ?mod_name:string -> unit -> t

Make a new code generator

  • parameter timestamp

    if true, prefix generated code with the current timestamp

  • parameter mod_name

    if provided, wrap generated code in a module

val plugins : t -> Imandra_surface.Plugin.set

Current set of plugins

val add_yojson : t -> unit

Add yojson plugin to the code generator

val add_pp : t -> unit

Add pretty-printing plugin to the code generator

val add_rand : t -> unit

Add random generation plugin to the code generator

val add_json : mod_name:string -> t -> unit

Add json plugin to the code generator

val add_header : t -> string -> unit

Add the given header before the generated code

val add_events : t -> Imandra_surface.Event.t list -> unit

Do code generation for the given events

val to_string : t -> string

Obtain the code for defining (de)serialization code for the imandra types addded to t.

val to_file : t -> string -> unit

to_file c filename dumps the code into the given file.