package libsail
Module Libsail.TargetSource
Infrastructure for plugins to register Sail targets.
A target is essentially a custom backend for the Sail compiler, along with various hooks and options that toggle various frontend behaviours. A target therefore specifies what kind of output Sail will produce. For example, we provide default plugins that define targets to output Lem, C, OCaml, Coq, and so on.
Target type and accessor functions
val run_pre_rewrites_hook :
target ->
Type_check.typed_ast ->
Effects.side_effect_info ->
Type_check.Env.t ->
unitTarget registration
val register :
name:string ->
?flag:string ->
?description:string ->
?options:(Arg.key * Arg.spec * Arg.doc) list ->
?pre_parse_hook:(unit -> unit) ->
?pre_initial_check_hook:(string list -> unit) ->
?pre_rewrites_hook:
(Type_check.typed_ast ->
Effects.side_effect_info ->
Type_check.Env.t ->
unit) ->
?rewrites:(string * Rewrites.rewriter_arg list) list ->
?asserts_termination:bool ->
(string option -> Interactive.State.istate -> unit) ->
targetUsed for plugins to register custom Sail targets/backends.
register_target ~name:"foo" action will create an option -foo, that will run the provided action on the Sail abstract syntax tree after performing common frontend processing.
The various arguments can be used to further control the behavior of the target:
The final unnamed parameter is the main backend function that is called after the frontend has finished processing the input.
Use if you want to register a target that does nothing
Return the current target. For example, if we register a 'coq' target, and Sail is invoked with `sail -coq`, then this function will return the coq target.
Used internally when updating the option list during plugin loading