Acutis
This is the main API wrapper around the compiler internals (Acutis_internals
).
type 'a compile_result := message list * 'a option
The result of a compile computation. The first value is a list of warnings and error messages. If the second value is Some
then the computation succeeded. If None
, then it failed for the reasons in the messages. A successful computation may have warning messages.
A template component. Parameter 'a
is the type of external components, which may either be a function or a js_import
.
Convert a parsed Acutis template into a component. The string is the name the component is called in Acutis code.
Convert a function or a js_import
into a template component. The string is the name the component is called in Acutis code.
val comps_compile : 'a comp Stdlib.Seq.t -> 'a comps_compiled compile_result
Type-check, optimize, and link the components.
val comps_empty : 'a comps_compiled
val parse : Stdlib.Lexing.lexbuf -> parsed compile_result
Parse a component. This does not type-check, optimize, or link yet.
val compile : 'a comps_compiled -> parsed -> 'a compiled compile_result
Type-check, optimize, and link the template with its components.
val compile_interface : Stdlib.Lexing.lexbuf -> interface compile_result
Parse and type-check a type interface with no template.
module type DECODABLE = sig ... end
A specification for decoding and encoding input data.
module Of_decodable (D : DECODABLE) : sig ... end
A functor that builds functions to render templates and construct type interfaces from decodable data.
val js_import : module_path:string -> function_path:string -> js_import
Print a template as a CommonJS module.
Print a template as an ECMAScript module.
val pp_message : Stdlib.Format.formatter -> message -> unit
Pretty-print an error message.
val pp_interface : Stdlib.Format.formatter -> interface -> unit
Pretty-print a type interface in Acutis syntax.
val pp_ast : Stdlib.Format.formatter -> parsed -> unit
Pretty-print a template's abstract syntax tree in S-expression syntax.
val pp_compiled : Stdlib.Format.formatter -> _ compiled -> unit
Pretty-print a fully-compiled template in S-expression syntax.
val pp_instructions :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a compiled ->
unit
Pretty-print runtime instructions in S-expression syntax.
val pp_js_import : Stdlib.Format.formatter -> js_import -> unit
Pretty-print JavaScript import data in S-expression syntax.