ppRegEqnsFm
functor
signature PPREGEQNSFM
functor ppRegEqnsFm
(NAMES) : PPREGEQNSFM
This functor generates funtions that translate between regular recursion equations and finite automata (without epsilon-transitions). Moreover, printing functions for regular expressions and displaying of finite automata are generated, using printnames as provided by the argument structure.
More detailed printing functions showing equivalence classes of states are contained in the substructure M.
structure E : PPREGEQNS
structure M : PPFM
sharing type M.label = E.alph
type ''a machine = ''a M.machine
type label = M.label
datatype re = datatype E.re
type 'a eqns = 'a re E.eqns
val printExp : label re -> unit
val printEqns : label eqns -> unit
val accept : ''a machine -> ''a list -> bool
val display : label machine -> string -> OS.Process.status
val retofm : ''a re -> ''a machine
val retominfm : ''a re -> ''a machine
val fmtore : ''a machine -> ''a re
structure E : PPREGEQNS
structure M : PPFM
sharing type M.label = E.alph
type ''a machine = ''a M.machine
type label = M.label
datatype re = datatype E.re
type 'a eqns = 'a re E.eqns
printExp r
printEqns eqs
accept m l
display m s
retofm r
retominfm r
fmtore m
NAMES, PPREGEXP, PPFM
Example:
A finite machine is translated to a (right-linear) system of recursion equations and then printed:
structure StringNames = Names(StringLabels); structure ppEM = ppRegEqnsFm(StringNames) open ppEM; val ndM = M.make{trans = [(0,"a",1),(0,"a",2), (1,"a",0),(1,"b",2), (2,"b",0),(2,"b",1)], start=[0,2], final=[1,2]}; printEqns(fmToEqns ndM);The equation system is printed as follows:Equation system: x_0 = (a;x_1 + a;x_2) x_1 = (1 + a;x_0 + b;x_2) x_2 = (1 + b;x_0 + b;x_1) x_3 = (x_0 + x_2)The first variables correspond to the states of the machine; the last variable defines the sum of the components corresponding to the initial states.