Eval
val init :
?syntax:Types.Syntax.t ->
?meta:char ->
?warning:bool ->
?implicit:bool ->
Types.prims ->
Types.forms ->
(Types.state, string) Stdlib.result
val reset : ?wipe:bool -> Types.state -> Types.state
(reset ~wipe state)
returns state
with the active and neutral strings reset to empty.
When folding over a Types.state
, it's usually important to reset
it before passing it to eval
.
If (wipe = true)
, the forms store is cleared, and all open in and out channels are closed (default: false
).
val eval :
Types.state ->
string ->
(Types.state * string, Types.error) Stdlib.result
(eval state str)
returns (Ok str)
with all TINT expressions evaluated in the context of state
.
If an error occurs, (Error err)
is returned.
module Prims : sig ... end
Functions for creating new primitives.
module Forms : sig ... end
Functions for manipulating forms and the forms store.
val prims :
(Types.state -> Types.M.key Stdlib.List.t -> Types.return) {Types}3.M.t
prims
is the union of Trac.prims
and New.prims
.
This is the usual default set of TINT primitives. No I/O primitives are included. I/O primitives are defined as any that provide access to the file system, external processes, network sockets, or the like. See prims_io
.
val prims_io :
(Types.state -> Types.M.key Stdlib.List.t -> Types.return) {Types}3.M.t
prims_io
is the union of prims
and Io.prims
.
These primitives include those that can access the file system, spawn external processes, open network sockets, or the like.
val run :
?debug:bool ->
?syntax:Types.Syntax.t ->
?warning:bool ->
string ->
(unit, string) Stdlib.result
(run ?debug ?syntax ?warning str)
is a convenience function for evaluating str
in the default Types.state
.
The default state is that returned by init
prims
forms
.
Defaults:
debug
is false
syntax
is Types.Syntax.trac
warning
is false