diff options
Diffstat (limited to '')
-rw-r--r-- | src/Identifiers.ml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Identifiers.ml b/src/Identifiers.ml index 21898498..cab1bafa 100644 --- a/src/Identifiers.ml +++ b/src/Identifiers.ml @@ -9,11 +9,14 @@ open Errors module type Id = sig type id + type generator + (** Id generator - simply a counter *) + type 'a vector val zero : id - val incr : id -> id + val fresh : generator -> id * generator val to_string : id -> string @@ -53,6 +56,8 @@ module IdGen () : Id = struct (* TODO: use Int64.t *) type id = int + type generator = id + type 'a vector = 'a list let zero = 0 @@ -63,6 +68,8 @@ module IdGen () : Id = struct * they happen *) if x == max_int then raise (Errors.IntegerOverflow ()) else x + 1 + let fresh gen = (gen, incr gen) + let to_string = string_of_int let empty_vector = [] |