module LogicId: sig
.. end
Logical Identifiers
type
id = string * int
module S: sig
.. end
include S
module Iset: Set.Make
(
S
)
module Imap: Map.Make
(
S
)
module Ihmap: Hashtbl.Make
(
S
)
module Kset: Set.Make
(
String
)
module Kmap: Map.Make
(
String
)
val idref : int Pervasives.ref
val idfree : int list Pervasives.ref
val dummy : string * int
Only usable for represent in projectified definitions
val extern : Ihmap.key Kmap.t Pervasives.ref
val create : 'a -> 'a * int
Create a new fresh identifier with the given basename
val basename : 'a * 'b -> 'a
val library : Kmap.key -> Ihmap.key
Returns an id for an external symbol
type
allocator = {
|
mutable index : int ; |
|
mutable free : int list ; |
|
mutable based : bool ; |
|
mutable count : int ; |
}
type
space = {
|
mutable alloc : (string, allocator) Hashtbl.t ; |
|
mutable locals : Iset.t ; |
|
mutable reserved : Kset.t ; |
|
indices : indice Ihmap.t ; |
}
type
indice =
| |
Base |
| |
Idx of int |
| |
Link of string |
val allocator : space -> string -> allocator
val unalloc : space -> Ihmap.key -> unit
val push : space -> string -> string * int
val pop : space -> Iset.elt -> unit
type
mark = Iset.t
val mark : space -> Iset.t
val unmark : space -> Iset.t -> unit
val clear : space -> unit
val reserve1 : space -> Kset.elt -> unit
val reserved : space -> Kset.elt list -> unit
Reserves the given names to avoid clash with generated ones.
val link : space -> Ihmap.key -> Kset.elt -> unit
Link the identifier to some absolute name.
Also reserves this name.
val space : unit -> space
Creates an empty name space (but with the external names).
val indice : space -> bool -> Ihmap.key -> indice
val name : space -> ?unique:bool -> Ihmap.key -> string
Assigns a unique string to an identifier in the space.
When flag unique
is set to true, the generated name
is preferrably the basename of the identifier.
val unique : space -> Ihmap.key -> unit
Reserves the identifier to be assigned its basename as name, if possible.
Same as using name space ~unique:true id
.
val pp_id : space -> Format.formatter -> Ihmap.key -> unit
Combines name
and Format
.
val touch : space -> string * 'a -> unit
Count the identifier in the space.
If the identifier has been counted exactly once,
the first time its name is asked, the basename would be
assigned to it.
val copy : space -> space
Duplicates a name space.
val iter : (Ihmap.key -> string -> unit) -> space -> unit
type
tk =
| |
Letter |
| |
Digit |
| |
Symbol |
| |
End |
val letter : string -> int -> tk
val extend : string -> int -> tk -> int
val compare_token : string -> string -> int -> int -> int
val alpha : string -> string -> int
User-friendly name sorting. Namely: a<A<b
and 1<10
.