acgtk

Abstract Categorial Grammar development toolkit
Library acgtkLib.acgData
exception Signature_not_found of string

This exception can be raised when a signature or an entry is not found in the environmnent

exception Lexicon_not_found of string
exception Entry_not_found of string

The modules implementing the signatures and the lexicons managed by the environment

Exceptions raised when interpretations of types or constants are duplicated

type t

The type of the environment

type entry =
| Signature of Signature1.t
| Lexicon of Lexicon.t

The type of what an environment can contain

val empty : t

empty is the empty environmnent

val insert : ?overwrite:bool -> entry -> to_be_dumped:bool -> t -> t

insert c d e adds the content c into the environment e and returns the resulting environmnent. If d is set to true, then c is dumped in e by the Environment.Environment_sig.write function. The default value for the overwrite optional parameter is false.

val get_signature : string -> t -> Signature1.t

get_signature name e returns the signature of name name in the environment e. Raise Environment.Environment_sig.Signature_not_found if such a signature does not exist

val get_lexicon : string -> t -> Lexicon.t

get_lexicon name e returns the signature of name name in the environment e. Raise Environment.Environment_sig.Lexicon_not_found if such a signature does not exist

val get : string -> t -> entry

get name e returns the entry of name name in the environment e. Raise Environment.Environment_sig.Lexicon_not_found if such an entry does not exist.

val append : ?overwrite:bool -> t -> t -> t

append e1 e2 merges the two environment e1 and e2. If an entry appears in both environment then the one of e2 is kept if the overwrite parameter is set to true (default is false). If set to false, if an entry appears in both environment, an error is emitted.

val iter : ( entry -> unit ) -> t -> unit

iter f e applies f to every data contained in the environment

val fold : ( entry -> 'a -> 'a ) -> 'a -> t -> 'a

fold f a e returns f a_n (f a_n-1 (... (f a1 (f a0 a)) ... )) where the a_0 ... a_n are the n+1 elements of the environmnent

val sig_number : t -> int

sig_number e returns the number of signatures an environment contains

val lex_number : t -> int

sig_number e returns the number of lexicons an environment contains

val choose_signature : t -> Signature1.t option

choose_signature e returns a randomly chosen signature in the environment e

val compatible_version : t -> bool

compatible_version e returns true if the environment e was created with the current versions of the compilers and/or interpreter

val read : string -> string list -> t option

read filename dirs returns Some e if the file filename contains the output value of an enviromnent compatible with the current version of the software. It returns None otherwise. The file filename is looked up in the list of directories dirs.

val write : string -> t -> unit

write filename e write the output value of the enviromnent e into the file filename

val select : string -> t -> t
val unselect : t -> t
val focus : t -> entry option