View Source Formulae.Compiler (formulae v0.17.1)
The process to be spawned to compile Formulae
instances without clashes.
Elixir is great in parallel compilation, and in highly concurrent environment in-place compilation of the same formulas might result in clashes.
If your application already uses Finitomata
, compiler would be created as
an instance of it, simply launch it as
Finitomata.start_fsm YOUR_FINITOMATA_SUP, Formulae.Compiler, "Compiler", nil
otherwise it’ll be compiled into a regular GenServer
module exporting
start_link/0
.
Once started, one might simply use Compiler.compile(formula, options)
and Compiler.eval(formula, options)
.
Summary
Types
@type t() :: %Formulae.Compiler{ payload: term(), formulas: %{optional(binary()) => Formulae.t()} }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Compiles a formula if it has not yet been compiled, otherwise it’s a noop.
@spec eval( id :: Finitomata.id(), name :: Finitomata.fsm_name(), formula :: Formulae.t() | binary() | {binary(), keyword()}, binding :: keyword() ) :: any()
Evaluates a formula. If it hsa not been compiled yet, sinchronously compiles it first.
@spec formulas(id :: term(), name :: term()) :: %{optional(binary()) => Formulae.t()}
Returns all the compiled Formulae
modules known to the system.