Plugins are written in OCaml. The compiled OCaml code is then loaded in Stog with the --plugin or --package options of stog (see ).

A plugin can register new base rules and new modules.

A plugin can add rewrite rules to the rules of function of module Base.

Here is an example:

Have a look at the .

A plugin can also register a complete module, with named functions associated to levels. These levels can also be specified in the .stog/config file as explained here.

An example of such a plugin is stog_multi_doc.

The plugin is simply compiled with

ocamlfind ocamlopt -package stog -rectypes -shared -o plugin_example.cmxs plugin_example.ml

for native code or

ocamlfind ocamlc -package stog -rectypes -c plugin_example.ml

for bytecode.

The plugin is used by specifying it on the stog command line:

stog --plugin plugin_example.cmxs ...

or, if the plugin is installed with ocamlfind:

stog --package plugin_example ...

With our plugin example registering just a base rule, we can use the new "list":

first thingsecond thing
something else
]]>

This will be evaluated (reduced) to

first thingsecond thing
something else