Ch.5 Setting up SML# programming environment

§ 5.5. Let's try SML# interactive mode

Include the SML# installation directory in your command load path, so that you can run SML# by the name smlsharp. When invoked without any parameter, SML# stars its interactive session by printing the following message and waits for your input.

$ smlsharp
SML# version 2.0.0 (2014-03-31 10:23:45 JST) for x86-linux with LLVM 3.4

The “# ” character is the prompt SML# prints. In this document, we write “” for the shell prompt.

After this message, the compiler repeats the following steps.

  1. Read the user input up to “;”.

  2. Compile the input program and execute it.

  3. Print the result.

The following is a simple example.

# "Hello world";
val it = "Hello world" : string

The first line is the user input. The second line is the response of SML# system. As seen in this example, the compiler prints the result value with its type, and binds it to a name for subsequent use. If the user does not specify the name, the compiler uses “it” as the default name.