How to run the prodcom-cml.sml example -------------------------------------- [Note: The instructions for compiling and running CML programs on the CML FAQ page are out-of-date, so use the following instructions in their place.] In order to run a CML example program like prodcon-cml.sml, we need to arrange for the CML library to be loaded. One way of doing this is to compile prodcon-cml.sml using CM, the SML/NJ Compilation Manager. Here is how to do this. 1. We will assume that the program sources, in this case the single SML source file prodcon-cml.sml, are in the current directory. 2. We use a CM "description file", in this case prodcon-cml.cm, that tells CM what libraries and source files to compile and load (or just load if they have previously been compiled). In this case the prodcon-cml.cm file contains the following: ------------------------ prodcon-cml.cm ------------------------ Group is $cml/basis.cm $cml/cml.cm prodcon-cml.sml ------------------------ This specifies that a CML-compatible version of the Basis library, and the CML library itself are to be loaded, and then the program source file prodcon-cml.sml. 3. In the interactive SML REPL, we invoke CM with the command: - CM.make "prodcon-cml.cm"; This loads the libraries and compiles prodcon-cml.sml. Now we can run the program by executing: - Main.run(); and this will try to print out all nonnegative integers (until you interrupt it). ================================================================= For documentation on the CM compilation manager, see: http://www.smlnj.org/Doc/CM/new.pdf CM is tool that is used for compiling and loading any nontrivial multi-file program, especially if it depends on nondefault libraries.