Commit a268281b authored by POTTIER Francois's avatar POTTIER Francois

Moved the old implementation of [ba] to attic/.

parent 1a06e572
......@@ -49,29 +49,9 @@
(* -------------------------------------------------------------------------- *)
(* [ba] could be defined in terms of [reduce], as follows. *)
#define BA_CLASS __ba
#define BA_FUN(term) CONCAT(ba_, term)
#define __BA \
class ['self] BA_CLASS = object (_ : 'self) \
inherit [_] reduce \
inherit [_] KitBa.reduce \
end \
#define BA(term) \
let BA_FUN(term) t = \
new BA_CLASS # VISIT(term) () t \
#undef __BA
#undef BA
(* -------------------------------------------------------------------------- *)
(* We prefer to define [ba] in terms of [iter] because we wish to eliminate
our dependency on [reduce] visitors. *)
#define __BA \
class ['self] BA_CLASS = object (_ : 'self) \
inherit [_] iter \
......
(* This kit serves to compute the set of ``bound atoms'' of a term, that is,
the set of all binding name occurrences. *)
(* This computation can be performed either on top of an [iter] visitor, or
on top of a [reduce] visitor. *)
class ['self] iter = object (_ : 'self)
val mutable accu = Atom.Set.empty
......@@ -18,20 +15,3 @@ class ['self] iter = object (_ : 'self)
()
end
class ['self] reduce = object (_ : 'self)
method private extend _x () =
()
method private visit_'fn () _x =
Atom.Set.empty
(* The monoid of sets of atoms is used. *)
inherit [_] Atom.Set.union_monoid
(* An atom is added to the set of bound atoms when its scope is exited. *)
method private restrict x xs =
Atom.Set.add x xs
end
(* -------------------------------------------------------------------------- *)
(* Computing the bound atoms of a term, via [reduce]. *)
class ['self] reduce = object (_ : 'self)
method private extend _x () =
()
method private visit_'fn () _x =
Atom.Set.empty
(* The monoid of sets of atoms is used. *)
inherit [_] Atom.Set.union_monoid
(* An atom is added to the set of bound atoms when its scope is exited. *)
method private restrict x xs =
Atom.Set.add x xs
end
(* -------------------------------------------------------------------------- *)
#define __BA \
class ['self] BA_CLASS = object (_ : 'self) \
inherit [_] reduce \
inherit [_] KitBa.reduce \
end \
#define BA(term) \
let BA_FUN(term) t = \
new BA_CLASS # VISIT(term) () t \
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment