module type MACHINE_TYPE = sig
.. end
The output signature of Machines.Make
.
include X.X_TYPE
The following list summarizes the function in X.X_TYPE
.
- Type
t
is a record, i.e. machines have type {starts:nodeSet;finals:nodeSet;edges:edgeSet}
.
name
is "FSM"
.
compare
is compare
.
pair
is the intersection. See the function inter
below.
of_string
returns a FSM from its string representation. The
left brace/tag and right brace/tag of the string are given by the the
functions D.lb
and D.rb
. These can be empty strings. The
components of the machine will be delimited by D.delim
which cannot
be empty.
to_string
returns a string representation of a machine.
print
prints a machine followed by an endline.
print_
prints a machine but no endline.
type
nodeSet
Sets of nodes in a machine have this type.
type
edgeSet
Sets of edges in a machine have this type.
val empty : t
The empty machine.
val make : nodeSet ->
nodeSet -> edgeSet -> t
make s f e
returns a machine with start states equal to s
, final
states equal to f
and edges equal to e
.
val of_file : string -> t
of_file filename
returns a finite state machine from reading file
filename
.
val to_file : string -> t -> unit
to_file filename fsm
writes fsm
to file graphname
.
to_dotfile ?size ?rd ?shape ?fs path filename fsm
returns a
string representation of fsm
that can be interpreted by AT&T's
Graphviz drawing program. Optionally
you can specify the size
, the rank direction rd
, the shape of the
nodes shape
, and the fontsize to be used in edges and nodes fs
. See
the Graphviz documentation for
more information about these options.
val to_dotstring : ?size:string ->
?rd:string -> ?shape:string -> ?fs:string -> string -> t -> string
val to_dotfile : ?size:string ->
?rd:string -> ?shape:string -> ?fs:string -> string -> string -> t -> unit
to_dotfile ?size ?rd ?shape ?fs path graphname fsm
writes a string
representation of
fsm
that can be interpreted by AT&T's
Graphviz drawing program to a file. The name of
the file is
graphname
and it is written in location
path
(This
division is necessary because not all legal graph names in Graphviz are
filenames, e.g. graph names cannot begin with numerals). As in
to_dotstring
you may optionally specify the
size
, the rank direction
rd
, the shape of the nodes
shape
, and the fontsize to be used in
edges and nodes
fs
.
val report : t -> unit
Prints to standard output a summary of the size of the machine
Properties of machines
val starts : t -> nodeSet
Returns the start states of the machine.
val finals : t -> nodeSet
Returns the final states of the machine.
val edges : t -> edgeSet
Returns the edges of the machine.
val nodes : t -> nodeSet
Returns the nodes of the machine.
val is_cyclic : t -> bool
Returns true
iff the machine is cyclic.
val is_stripped : t -> bool
Returns true
iff the machine has no useless states.
Comparing machines
val are_isomorphic : t -> t -> bool
Returns true
iff the two machines are isomorphic.
val equal : t -> t -> bool
Returns true
iff the two machines have equal components.
Unary operations
val reverse : t -> t
Returns the reverse machine
val trim : t -> t
Returns a machine with no useless states.
val rename : t -> t
Renames the nodes of a machine. The new names are based on the positive
integers.
val rename_n : int -> t -> t
rename_n n m
renames the nodes of a machine beginning with integer n
.
Binary operations
val inter : t -> t -> t
inter m1 m2
returns the intersection of t1
and t2
.
val union : t -> t -> t
union m1 m2
returns a machine which is the union of the two
machines. Node names are renamed if there is a conflict.