Primus.Machine
Primus Machine.
The Machine is the core of Primus Framework. The Machine behavior is extended/changed with Machine components.
The user analysis is usually written in a form of a component, and is registered with the Primus.Components.register
function.
type id = Monads.Std.Monad.State.Multi.id
Machine identifier type.
val init : unit observation
A synonym to System.init
val finished : unit observation
A synonym to System.fini
val fork : (id * id) observation
fork (parent,child)
occurs when the machine parent
forks a new clone child
. The computation continues in the child
machine.
val switch : (id * id) observation
switch (was,now)
occurs when computation switches from the machine was
to the machine now
.
val exn_raised : exn observation
exn_raised exn
occurs every time an abnormal control flow is initiated
val kill : id observation
kill id
occurs when the machine id
is killed.
When this observation is made the machine enters the restricted mode with non-determinism and observations disabled.
module State : sig ... end
Machine State.
type 'a state = 'a State.t
module type State = sig ... end
An interface to the state.
module type S = sig ... end
The Machine interface.
type component = (module Component)
The Machine component.
Make(Monad)
a monad transformer that wraps the Machine into an arbitrary Monad
.
val add_component : component -> unit
add_component comp
registers the machine component comp
in the Primus Framework. The component's init
function will be run every time the Machine compuation is run. After all components are initialized, the init
observation is made.
The components shall not access the interpreter in their init
function. Instead, they should subscribe to observations and/or initialize the machine state via Linker/Memory/Env components.
See also a more general register_component
function.