The interactive top-level provides an interpreter-style environment that allows entering and evaluating programs from an interactive prompt.
The interactive top-level is designed to work with the standard Emacs mode for SML. A patched version of that mode, modified to harmonize with Alice ML syntax extensions, is also available from the Alice download page.
After preloading several components, the system will enter an interactive input-eval-output session. It allows entering arbitrary Alice components. Input can stretch several lines, it is terminated by a line containing a semicolon as its last character. The system will print the results and inferred types for the given declarations, or an appropriate error message.
Note that the inspect function from the Inspector is available to browse complex results conveniently.
Like in other SML systems, there also is the special purpose function
use : string -> unit
which, given the name of an Alice source file, will process this file as if it had been fed as direct input.
An interactive session can be terminated by typing an end-of-file character (Ctrl-D on Unix systems, Ctrl-Z on Windows systems).
Each input in the interactive toplevel actually is a component. This implies that import announcements can be entered to link in separately compiled components from arbitrary URIs:
- import structure Foo from "http://www.mydomain.net/Foo"; ### loaded signature from http://www.mydomain.net/Foo structure Foo : FOO = Foo -
For convenience, it is possible to abbreviate import announcements as follows in the interactive top-level:
- import "http://www.mydomain.net/Foo"; ### loaded signature from http://www.mydomain.net/Foo structure Foo : FOO = Foo -
Such an announcement will import all items exported by the corresponding component.
All library components (except the GTK library) are pre-imported in the interactive
top-level and will get loaded automatically on demand.
The same command line options are supported as for the standalone batch compiler.
The interactive top-level is parameterized by the same environment variables as the batch compiler.