V_______________________________________________________________ *)
module C = Cps
-module B = Bag
+module Z = Bag
module M = Meta
(* Internal functions *******************************************************)
let rec xlate_term c f = function
| M.Sort s ->
- let f h = f (B.Sort h) in
+ let f h = f (Z.Sort h) in
if s then f 0 else f 1
| M.LRef (_, i) ->
let l, _, _ = List.nth c i in
- f (B.LRef l)
+ f (Z.LRef l)
| M.GRef (_, uri, vs) ->
- let map f t v = f (B.appl v t) in
- let f vs = C.list_fold_left f map (B.GRef uri) vs in
+ let map f t v = f (Z.appl v t) in
+ let f vs = C.list_fold_left f map (Z.GRef uri) vs in
C.list_map f (xlate_term c) vs
| M.Appl (v, t) ->
- let f v t = f (B.Appl (v, t)) in
+ let f v t = f (Z.Appl (v, t)) in
let f v = xlate_term c (f v) t in
xlate_term c f v
| M.Abst (id, w, t) ->
let f w =
- let l = B.new_location () in
- let f t = f (B.Bind (l, id, B.Abst w, t)) in
+ let l = Z.new_location () in
+ let f t = f (Z.Bind (l, id, Z.Abst w, t)) in
let f c = xlate_term c f t in
- B.push "meta" f c l id (B.Abst w)
+ Z.push "meta" f c l id (Z.Abst w)
in
xlate_term c f w
let xlate_pars f pars =
let map f (id, w) c =
- let l = B.new_location () in
- let f w = B.push "meta" f c l id (B.Abst w) in
+ let l = Z.new_location () in
+ let f w = Z.push "meta" f c l id (Z.Abst w) in
xlate_term c f w
in
- C.list_fold_right f map pars B.empty_lenv
+ C.list_fold_right f map pars Z.empty_lenv
let unwind_to_xlate_term f c t =
- let map f t (l, id, b) = f (B.bind l id b t) in
+ let map f t (l, id, b) = f (Z.bind l id b t) in
let f t = C.list_fold_left f map t c in
xlate_term c f t
let f c = unwind_to_xlate_term f c u in
xlate_pars f pars
| pars, u, Some t ->
- let f u t = f (B.Cast (u, t)) in
+ let f u t = f (Z.Cast (u, t)) in
let f c u = unwind_to_xlate_term (f u) c t in
let f c = unwind_to_xlate_term (f c) c u in
xlate_pars f pars