Imandra_interactive.Imandra
set_lockdown uid
enables lockdown mode. It will restrict what functions are in scope, and will Unix.setuid
to the given user ID. NOTE: must be called before do_init
or loop
val do_init :
?scope:Opentelemetry.Trace.scope ->
?linenoise:bool ->
?syntax:Imandra_syntax.Syntax.t ->
unit ->
unit
Initialize the toplevel environment. Can be safely called several times but will only do something on the first call
Event triggered on every source code string evaluated. This may NOT include calls to #use
and others.
Event triggered for every top phrase evaluated, including program mode ones.
val use_iml :
?scope:Opentelemetry.Trace.scope ->
?syntax:Imandra_syntax.Syntax.t ->
?quiet:bool ->
string ->
unit
use_iml file
loads the file in imandra, as #use "file"
would do.
val eval :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?mode:Imandra_util.Mode.t ->
input:Imandra_util.Iloc.Input.t ->
Parsetree.toplevel_phrase ->
Imandra_surface.Top_result.t list
evaluate the given toplevel phrase.
val eval_string :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?syntax:Imandra_syntax.Syntax.t ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?mode:Imandra_util.Mode.t ->
?filename:string ->
string ->
Imandra_surface.Top_result.t list
eval_string "1+1;;"
will evaluate the given string as an Imandra statement.
val eval_string_result :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?syntax:Imandra_syntax.Syntax.t ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?mode:Imandra_util.Mode.t ->
?filename:string ->
string ->
unit Imandra_util.Error.result * Imandra_surface.Top_result.t list
eval_string_result "1+1;;"
will evaluate the given string as an Imandra statement.
val eval_string_iter :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?syntax:Imandra_syntax.Syntax.t ->
filename:string ->
string ->
( (Imandra_util.Iloc.t list
* Imandra_util.Console.Capture.t
* Imandra_surface.Top_result.t list
* Imandra_surface.Event.t list Imandra_util.Error.result) ->
unit ) ->
unit
eval_string_iter code f
evaluates code
into a list of events, processes these events one by one, calling f
on the result of each event. Each result is: (locations, console, res)
Precondition: do_init ()
was called.
val eval_string_returning_string :
?scope:Opentelemetry.Trace.scope ->
syntax:Imandra_syntax.Syntax.t ->
string ->
string
eval_string_returning_string s
evaluates s
, which must be a code fragment returning a string, and returns the resulting string value.
Example:
# Imandra.eval_string_returning_string {| "hello " ^ "world" |};;
- : string = "hello world"
# Imandra.eval_string_returning_string {| Printf.sprintf "%B" true |};;
- : string = "true"
val parse_file :
?syntax:Imandra_syntax.Syntax.t ->
string ->
( Parsetree.toplevel_phrase list * Imandra_util.Iloc.Input.t, exn )
Stdlib.result
Parse given file
val parse_string :
?syntax:Imandra_syntax.Syntax.t ->
?filename:string ->
string ->
( Parsetree.toplevel_phrase list
* Imandra_util.Iloc.Input.t
* Imandra_util.Iloc.t,
Imandra_util.Error.t )
Stdlib.result
Parse given string.
port ~var expr
ports the content of expr
, typically a variable (which must have a logic type) into logic mode, into the new variable var
.
module Gc_stat : sig ... end
Add the given plugin and apply it to history retroactively. From now on all events will be processed by this plugin. It blocks until all code fragments have been executed.
It is simpler to call this as early as possible if one wants to use #reset
or #undo
.
See Event_def_plugin
for more information.
val collect_history_for_plugin :
Imandra_surface.Event_def_plugin.t ->
Imandra_surface.Code_fragment.t list
Run the plugin on all events so far, but instead of executing its code fragments, just collect them
Define a custom extension point
val interactive_loop :
?scope:Opentelemetry.Trace.scope ->
?init:bool ->
?syntax:Imandra_syntax.Syntax.t ->
?linenoise:bool ->
stop:Imandra_util.Switch.t ->
unit ->
unit
Main loop for a toplevel that reads on stdin and prints on stdout.
val process_file :
?scope:Opentelemetry.Trace.scope ->
?init:bool ->
?syntax:Imandra_syntax.Syntax.t ->
string ->
Parsetree.toplevel_phrase list
* Imandra_surface.Event.t list
* Imandra_surface.Top_result.t list
* unit Imandra_util.Error.result
process_file path
parses the file and returns its content and a list of events. This is useful for batch compilation.
val import_file :
?scope:Opentelemetry.Trace.scope ->
?loc:Imandra_util.Iloc.t ->
?quiet:bool ->
string ->
unit
Import given module (and its dependencies, recursively) by its file name
val require_lib :
?scope:Opentelemetry.Trace.scope ->
?loc:Imandra_util.Iloc.t ->
?meth:[ `Mod_use | `Import | `Use ] ->
?quiet:bool ->
string ->
unit
Require an ocamlfind library and its Imandra attachment, using either import
or mod_use
to load its content.
module Gist : sig ... end