+
+let loop_begin t =
+ let loop = Sym.new_of_string "loop" in
+ let t = {t with loop = Some loop} in
+ (loop, t)
+
+let loop_end t given =
+ match t.loop with
+ | None ->
+ assert false
+ | Some current when (not (Sym.is_equal current given)) ->
+ assert false
+ | Some _ ->
+ {t with loop = None}
+
+let loop_current {loop; _} =
+ loop