let gentag =
  let r = ref 0 in
  fun () -> incr r; !r