aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Source.mli
blob: 0961dccc9c8c483f123ec766488aca12aa91aa1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(** programs as source. A program in any language travels the tree as a
    handle carrying [EphemeralRelation.Stored], with its text as the code,
    so whoever holds one can run it through the evaluator of its language
    without linking that language. *)

(** a program in [language]. *)
val program : language:string -> string -> Protocols.Handle.t

(** the language and text a handle carries, if it is a program. *)
val text : Protocols.Handle.t -> (string * string) option

(** an evaluator for [language]: it runs the text of a program in that
    language against the directory it is given, and refuses anything
    else. *)
val evaluator :
  language:string ->
  (within:Protocols.Handle.t -> string -> (Protocols.Handle.t, Concepts.Condition.condition) result) ->
  Protocols.Handle.t

(** where the evaluators are registered, from the root: \system\evaluator. *)
val evaluators : Path.t

(** run [program] through the evaluator of [language] found in
    [directory], against [within]. Usable as an
    [EphemeralRelation.binding] once [directory] and [within] are given. *)
val bind :
  Protocols.Handle.t ->
  within:Protocols.Handle.t ->
  string ->
  Protocols.Handle.t ->
  (Protocols.Handle.t, Concepts.Condition.condition) result

(** run [text] in [language] against [within], with the evaluator
    registered under [root]. *)
val run :
  Protocols.Handle.t ->
  language:string ->
  within:Protocols.Handle.t ->
  string ->
  (Protocols.Handle.t, Concepts.Condition.condition) result

(** register [evaluator] for [language] under [root]. *)
val register :
  Protocols.Handle.t ->
  language:string ->
  Protocols.Handle.t ->
  (unit, Concepts.Condition.condition) result