Commands#
General syntax#
OCaml code#
The code must be closed by as many closing delimiters as there were opening ones, of the matching kind.
For example, ocaml:(code), ocaml:[[code]] and ocaml:{{{code}}} are all valid.
Note
In general, you should prefer ocaml:{{code}}, since Rocq treats :{{ as a special case that does not end parsing on ..
Attributes#
Some commands, such as Camltac Run or Camltac Module, accept additional attributes that change their behavior.
Locality#
The locality attributes (local, global, export) specify how Camltac modules and snippets behave when imported.
The Camltac module is local to the current Rocq module; it disappears when the module is closed.
The Camltac module is loaded when the enclosing Rocq module is Require-ed.
The Camltac module is loaded when the enclosing Rocq module is Import-ed.
Build directives#
Build directives are special attributes that control how the OCaml code is compiled.
Links the given libraries before the OCaml snippet.
Applies a list of preprocessors to the OCaml code.
Example
One can use ppx_deriving to automatically derive printers for a type:
#[ppx="ppx_deriving.show"] Camltac Module M := ocaml:{{ type t = A | B [@@deriving show { with_path = false }] }}.
Pass the given compilation arguments to the compiler.