0

I am using SML NJ v110.78 on Mac OS X 10.9. I am trying to use command-line arguments from BASH, like so:

sml progname.sml 2.0 1.0.  

The program progname.sml compiles and runs and uses the command-line arguments to produce a value (using SMLofNJ.getArgs() function), but at the end of the processing, the REPL returns the error:

!* unable to process `2.0' (unknown extension `0')
!* unable to process `1.0' (unknown extension `0')
-

How do I avoid those final error messages?

Thank you.

Pinecone
  • 391
  • 4
  • 9

1 Answers1

1

You need to terminate the REPL with an exit statement:

val _ = OS.Process.exit(OS.Process.success);

When you don't exit the REPL in above manner then the command-line arguments are regarded by the interpreter as compiler extensions, hence the feedback:

!* unable to process `2.0' (unknown extension `0')

BTW: You can use OS.Process.exit(OS.Process.success); to exit the REPL as a cleaner alternative to CTRL+Z

How do I quit SML?

ML Command Line Options Cheat Sheet

Kevin Johnson
  • 1,890
  • 13
  • 15