Abstract Categorial Grammar development toolkit
Library acgtkLib.utilsLib
type identifier = id

identifier is the type of the identifier stored in the table. It is meant to be associated with a string

type table

The type of the table

exception Not_found

This exception can be raised when some identifier or some symbol is not found in a query

val empty : table

empty is an empty table

val find_id_of_sym : string -> table -> identifier

find_id_of_sym sym t returns the identifier of the string sym stored in t. Raises Not_found if no such identifier exists.

val find_sym_from_id : identifier -> table -> string

find_sym_from_id id t returns the string (i.e. the symbol) corresponding to the identifier id in table t

val add_sym : string -> table -> identifier * table

add_sym sym t returns a pair (id,t') where id is the identifier associated with sym in t'. If sym already was in t then t'=t and id is the identifier which it was associated with. Otherwise, a new identifier is generated and the new association is stored in t'.

val to_string : table -> string

to_string t outputs the table t in a string.

val log_content : Logs.level -> table -> unit

log_content level t logs the content of table t.

val fold : ( identifier -> string -> 'a -> 'a ) -> table -> 'a -> 'a

fold f table a returns f id1 sym1 (f id2 sym2 ( ... ( f idN symN a) ... )) where the (id,sym) pairs are the ones that are stored in the table table. The order of these key-value pairs in the table is unspecified.