11

I am using New Jersey SML on Windows. If test.sml is an SML file I can execute it by running this at a Windows command prompt:

C:\> sml test.sml

I then get the usual SML output and a new SML command prompt.

Standard ML of New Jersey v110.75 [built: Sat Sep 29 12:51:13 2012]
[opening hw1.sml]
val d2 = (1,1) : int * int
val d3 = (1,1) : int * int
val d4 = (2,1) : int * int
val d5 = (1,2) : int * int
val x7 = true : bool
-

What I would like instead is to be exited back to the Windows command prompt and not be left in the SML interactive mode.

How can I do this?

rlandster
  • 7,294
  • 14
  • 58
  • 96

3 Answers3

23

Did you try:

sml <test.sml

Beyond that, using its compilation manager (CM) SML/NJ actually allows you to compile a program into binaries and run them separately. The manual should be able to tell you more (see especially section 15 describing the ml-build command).

Andreas Rossberg
  • 34,518
  • 3
  • 61
  • 72
5

Running SML/NJ that way, it will open the REPL (read-eval-print-loop). Thus it will wait for new declarations to interpret, until you tell it to exit.

Acording to the SML/NJ faq on usage, then

The OS.Process.exit function is the proper means of quiting sml from within a program.

It takes either OS.Process.success or OS.Process.failure as argument.

Jesper.Reenberg
  • 5,944
  • 23
  • 31
1

Also from the command line you can:

Ctrl - C interrupts (incase of loops that will not exit etc...)

Ctrl - Z exits the REPL

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Phill Cole
  • 11
  • 3