Skip to content
Snippets Groups Projects
symbolTab.mli 1.81 KiB
Newer Older
Erwan Jahier's avatar
Erwan Jahier committed

(**********************************************************
Sous-module pour SrcTab 
************************************************************

   Une SymbolTab.t est une association ``contextuelle'' entre
des ident simple (string) et ce  quoi ils correspondent.
   N.B. il est inutile de grer les idents absolus (pack+nom)
qui sont par dfinition NON-CONTEXTUELS.
   Dans une table, on a 3 espaces de noms, un par nature d'item
(const, type et oper).

***********************************************************)
open CompUtils

type 'a hereflaged =
  Here of 'a
| NotHere of fullid

(* Type principal *)
type t

(* Cration/initialisation d'une symbol_tab 
n.b. l'argument est juste un commentaire pour les
messages d'erreurs et les verbose !!!
*)
val create : unit -> t

(* Manip de SymbolTab.t *)

(* Recherche d'items *)
val find_type : t -> string -> (Syntaxe.type_info Lxm.srcflaged) hereflaged
val find_const : t -> string -> (Syntaxe.const_info Lxm.srcflaged) hereflaged
val find_oper : t -> string -> (Syntaxe.oper_info Lxm.srcflaged) hereflaged

(* Ajout de nom d'item imports (via uses) *)
val add_import_const : t -> string -> fullid -> unit
val add_import_type : t -> string -> fullid -> unit
val add_import_oper : t -> string -> fullid -> unit

(* Ajout de decl d'item locaux *)
val add_type : t -> string -> Syntaxe.type_info  Lxm.srcflaged -> unit
val add_const : t -> string -> Syntaxe.const_info  Lxm.srcflaged -> unit
val add_oper : t -> string -> Syntaxe.oper_info  Lxm.srcflaged -> unit

(* Itrer sur les items *)

val iter_types : t -> (string -> (Syntaxe.type_info Lxm.srcflaged) hereflaged -> unit) -> unit
val iter_consts : t -> (string -> (Syntaxe.const_info Lxm.srcflaged) hereflaged -> unit) -> unit
val iter_opers : t -> (string -> (Syntaxe.oper_info Lxm.srcflaged) hereflaged -> unit) -> unit

val dump : t -> unit