Legend:
Library
Module
Module type
Parameter
Class
Class type
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.
Used 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:
parameter~name
The name of the target
parameter?flag
A custom command line flag to invoke the target. By default it will use the name parameter
parameter?description
A custom description for the command line flag
parameter?options
Additional options for the Sail executable
parameter?pre_parse_hook
A function to call right at the start, before parsing
parameter?pre_initial_check_hook
A function to call after parsing, but before de-sugaring
parameter?pre_rewrites_hook
A function to call before doing any rewrites
parameter?rewrites
A sequence of Sail to Sail rewrite passes for the target
parameter?asserts_termination
Whether termination measures are enforced by assertions in the target
The final unnamed parameter is the main backend function that is called after the frontend has finished processing the input.
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.