Instantly share code, notes, and snippets.

Embed
What would you like to do?
open Core
open Set
module type AUTOM' = sig
type ast (* for AlphSet.t *)
type sst (* for StateSet.t *)
type sset (* for StateSet.Elt.t *)
type aset (* for AlphSet.Elt.t *)
type t = {
alph: ast;
states: sst;
trans: sset -> aset -> sset;
init: sset;
final: sst}
end
module type AUTOM =
functor (AlphSet: Set.S) (StateSet: Set.S) ->
AUTOM'
with type ast = AlphSet.t
with type sst = StateSet.t
with type aset = AlphSet.Elt.t
with type sset = StateSet.Elt.t
module Autom = functor (AlphSet: Set.S) (StateSet: Set.S) -> struct
type ast = AlphSet.t
type sst = StateSet.t
type sset = StateSet.Elt.t
type aset = AlphSet.Elt.t
type t = {
alph: ast;
states: sst;
trans: sset -> aset -> sset;
init: sset;
final: sst}
end
type alph = Zero | One [@@deriving sexp, compare]
module Alph = struct
type t = alph
let compare = compare_alph
let t_of_sexp = alph_of_sexp
let sexp_of_t = sexp_of_alph
end
module AlphSet = Set.Make(Alph)
module StringSet = Set.Make(String)
module ZeroOneAutom = Autom(AlphSet)(StringSet)
open Core
open Set
module type AUTOM' = sig
type ast (* for AlphSet.t *)
type sst (* for StateSet.t *)
type sset (* for StateSet.Elt.t *)
type aset (* for AlphSet.Elt.t *)
type t = {
alph: ast;
states: sst;
trans: sset -> aset -> sset;
init: sset;
final: sst}
end
module type AUTOM =
functor (AlphSet: Set.S) (StateSet: Set.S) ->
AUTOM'
with type ast = AlphSet.t
with type sst = StateSet.t
with type aset = AlphSet.Elt.t
with type sset = StateSet.Elt.t
module Autom: AUTOM
type alph = Zero | One [@@deriving sexp, compare]
module Alph: Set.Elt
module AlphSet: Set.S with type Elt.t = alph
module StringSet: Set.S with type Elt.t = string
module ZeroOneAutom: AUTOM'
with type ast = AlphSet.t
with type sst = StringSet.t
with type aset = AlphSet.Elt.t
with type sset = StringSet.Elt.t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment