2010-06-15 14:05:26 +02:00
|
|
|
|
|
|
|
(** This modules manages unique identifiers,
|
|
|
|
[fresh] generates an identifier from a name
|
|
|
|
[name] returns a unique name from an identifier. *)
|
|
|
|
|
|
|
|
|
2010-06-15 10:49:03 +02:00
|
|
|
(** The (abstract) type of identifiers*)
|
2010-06-15 14:05:26 +02:00
|
|
|
type ident
|
2010-07-07 15:11:32 +02:00
|
|
|
|
|
|
|
(** Type to be used for local variables *)
|
|
|
|
type var_ident = ident
|
2010-06-15 10:49:03 +02:00
|
|
|
|
2010-09-30 19:13:43 +02:00
|
|
|
(** Comparision on idents with the same properties as [Pervasives.compare] *)
|
|
|
|
val ident_compare : ident -> ident -> int
|
|
|
|
|
2010-06-15 10:49:03 +02:00
|
|
|
(** Get the source name from an identifier*)
|
|
|
|
val sourcename : ident -> string
|
2010-06-15 14:05:26 +02:00
|
|
|
(** Get the full name of an identifier (it is guaranteed to be unique) *)
|
2010-06-15 10:49:03 +02:00
|
|
|
val name : ident -> string
|
2010-06-15 14:05:26 +02:00
|
|
|
(** [set_sourcename id v] returns id with its source name changed to v. *)
|
2010-06-15 10:49:03 +02:00
|
|
|
val set_sourcename : ident -> string -> ident
|
|
|
|
|
|
|
|
(** [fresh n] returns a fresh identifier with source name n *)
|
|
|
|
val fresh : string -> ident
|
2010-06-21 18:19:58 +02:00
|
|
|
(** [ident_of_name n] returns an identifier corresponding
|
2010-06-15 14:05:26 +02:00
|
|
|
to a _source_ variable (do not use it for generated variables). *)
|
2010-06-21 18:19:58 +02:00
|
|
|
val ident_of_name : string -> ident
|
2010-09-13 14:09:05 +02:00
|
|
|
(** Resets the sets that makes sure that idents are mapped to unique
|
|
|
|
identifiers. Should be called when scoping a new function. *)
|
|
|
|
val new_function : unit -> unit
|
2010-06-15 10:49:03 +02:00
|
|
|
|
|
|
|
(** Maps taking an identifier as a key. *)
|
|
|
|
module Env :
|
2010-06-15 14:05:26 +02:00
|
|
|
sig
|
|
|
|
include (Map.S with type key = ident)
|
2010-06-26 16:53:25 +02:00
|
|
|
|
2010-06-15 14:05:26 +02:00
|
|
|
val append : 'a t -> 'a t -> 'a t
|
|
|
|
val union : 'a t -> 'a t -> 'a t
|
|
|
|
val diff : 'a t -> 'b t -> 'a t
|
|
|
|
val partition : (key -> bool) -> 'a t -> 'a t * 'a t
|
|
|
|
end
|
2010-06-15 10:49:03 +02:00
|
|
|
|
|
|
|
(** A set of identifiers. *)
|
|
|
|
module IdentSet :
|
2010-06-15 14:05:26 +02:00
|
|
|
sig
|
|
|
|
include (Set.S with type elt = ident)
|
|
|
|
val fprint_t : Format.formatter -> t -> unit
|
|
|
|
end
|