diff options
Diffstat (limited to 'lib/kernel/Source.mli')
| -rw-r--r-- | lib/kernel/Source.mli | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/lib/kernel/Source.mli b/lib/kernel/Source.mli index 0961dcc..b0479f2 100644 --- a/lib/kernel/Source.mli +++ b/lib/kernel/Source.mli @@ -1,28 +1,45 @@ (** 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. *) + without linking that language. -(** a program in [language]. *) + An evaluator is named [scope:language] and registered at + \[scope]\evaluator\[language]; a bare [language] is the system's. *) + +(** a program in [language], to run. *) val program : language:string -> string -> Protocols.Handle.t -(** the language and text a handle carries, if it is a program. *) +(** a program in [language] defining a relation of [heading], to store in + a branch, where reading it runs it. *) +val view : + language:string -> + heading:Protocols.Schematics.relation_description -> + string -> + Protocols.Handle.t + +(** the evaluator 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. *) +(** an evaluator name split into its scope and language. *) +val reference : string -> string * string + +(** an evaluator for [language]. A stored relation read from a branch is + given to [view] with its name: what the source defines under that + name, read [within] the branch state. Anything else is given to + [run]. *) val evaluator : language:string -> + ?view: + (within:Protocols.Handle.t -> + name:string -> + string -> + (Protocols.Handle.t, Concepts.Condition.condition) result ) -> (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. *) +(** run [program] through the evaluator named [evaluator] under [root], + [within] the given directory. Usable as an [EphemeralRelation.binding] + once [root] and [within] are given. *) val bind : Protocols.Handle.t -> within:Protocols.Handle.t -> @@ -30,8 +47,8 @@ val bind : Protocols.Handle.t -> (Protocols.Handle.t, Concepts.Condition.condition) result -(** run [text] in [language] against [within], with the evaluator - registered under [root]. *) +(** run [text] with the evaluator named [language] under [root], [within] + the given directory. *) val run : Protocols.Handle.t -> language:string -> @@ -39,9 +56,10 @@ val run : string -> (Protocols.Handle.t, Concepts.Condition.condition) result -(** register [evaluator] for [language] under [root]. *) +(** register [evaluator] as \[scope]\evaluator\[language] under [root]. *) val register : Protocols.Handle.t -> + scope:string -> language:string -> Protocols.Handle.t -> (unit, Concepts.Condition.condition) result |
