package acgtk

  1. Overview
  2. Docs
Abstract Categorial Grammar development toolkit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

acg-2.2.0-20251107.tar.gz
sha512=07f391d052090bb70c10ec511fdc53af764954cbe1c30093778984c5ed41a4327573fdac0890c6fd619ff9827725572eb7b8a7545bd8ccb7f5bddb84d2d7f7cc

doc/acgtk.acgData/AcgData/Environment/Environment/index.html

Module Environment.EnvironmentSource

This module signature describes the interface for modules implementing environments

Sourcetype t

The type of the environment

Sourcetype dumped_t

The type of the environment when dumped to file

Sourcetype entry =
  1. | Signature of Signature.Data_Signature.t
  2. | Lexicon of Acg_lexicon.Data_Lexicon.t
    (*

    The type of what an environment can contain

    *)
Sourceval empty : t

empty is the empty environmnent

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

insert c ~to_be_dumped:d e adds the content c into the environment e and returns the resulting environmnent. If d is set to true, then c will be dumped in e . The default value for the overwrite optional parameter is false.

Sourceval list_signatures : t -> string list

list_signatures e returns a list containing the names of all signatures in the environment e.

Sourceval list_lexicons : t -> string list

list_lexicons e returns a list containing the names of all lexicons in the environment e.

Sourceval prepare_dump : ?force:bool -> filename:string -> t -> dumped_t

prepare_dump ~filename e returns the environment a ready to be dumped (in file filename environment of type dumped_t similar to e, but without the data which has false in to_be_dumped. The data of the returned environment has false in to_be_dumped. If force is set to true (default is false), all the data available in the environement are dumped anyway, whether they have their to_be_dumped flag set to true or not. It is useful in case we want to generate a full environment out of only object files.

Sourceval get : string -> t -> UtilsLib.Error.pos -> entry

get name e loc returns the entry of name name in the environment e. Raise a corresponding error is there is no such entry.

Sourceval get_opt : string -> t -> entry option

get_opt name e returns the entry of name name in the environment e. Returns none if there is no such entry.

Sourceval get_signature : string -> t -> UtilsLib.Error.pos -> Signature.Data_Signature.t

get name e loc returns the signature of name name in the environment e. Raise a corresponding error is there is no such signature.

Sourceval get_lexicon : string -> t -> UtilsLib.Error.pos -> Acg_lexicon.Data_Lexicon.t

get name e loc returns the lexicon of name name in the environment e. Raise a corresponding error is there is no such lexicon.

Sourceval append : ?overwrite:bool -> t -> dumped_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.

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

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

Sourceval 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

Sourceval sig_number : t -> int

sig_number e returns the number of signatures an environment contains

Sourceval lex_number : t -> int

sig_number e returns the number of lexicons an environment contains

Sourceval choose_signature : t -> Signature.Data_Signature.t option

choose_signature e returns a randomly chosen signature in the environment e

Sourceval magic : t -> t

magic env returns a new env where all the magic programs for all the lexicons have been created