KitBa.ml 482 Bytes
Newer Older
POTTIER Francois's avatar
POTTIER Francois committed
1
(* This kit serves to compute the set of ``bound atoms'' of a term, that is,
2
   the set of all binding name occurrences. *)
POTTIER Francois's avatar
POTTIER Francois committed
3 4 5 6 7 8 9 10 11

class ['self] reduce = object (_ : 'self)

  method private extend _x () =
    ()

  method private visit_'fn () _x =
    Atom.Set.empty

12 13
  (* The monoid of sets of atoms is used. *)
  inherit [_] Atom.Set.union_monoid
POTTIER Francois's avatar
POTTIER Francois committed
14

15
  (* An atom is added to the set of bound atoms when its scope is exited. *)
POTTIER Francois's avatar
POTTIER Francois committed
16
  method private restrict x xs =
17
    Atom.Set.add x xs
POTTIER Francois's avatar
POTTIER Francois committed
18 19

end