Skip to content

michelou/sml-examples

Repository files navigation

Playing with Standard ML on Windows

SML project This repository gathers Standard ML examples coming from various websites and books.
It also includes several build scripts (batch files, Make scripts) for experimenting with Standard ML on a Windows machine.

Ada, Akka, C++, COBOL, Dafny, Dart, Deno, Docker, Erlang, Flix, Go, GraalVM, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.

Project dependencies

This project depends on the following external software for the Microsoft Windows platform:

Optionally one may also install the following software:

For instance our development environment looks as follows (January 2025) 1:

C:\opt\ConEmu\                   ( 26 MB)
C:\opt\Git\                      (389 MB)
C:\opt\mlton\                    ( 46 MB)
C:\opt\mosml\                    (  5 MB)
C:\opt\smlnet\                   (  7 MB)
C:\opt\SMLNJ\2                   ( 36 MB)
C:\opt\VSCode\                   (370 MB)

Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we defined C:\opt\ as the installation directory for optional software tools (in reference to the /opt/ directory on Unix).

Directory structure

This project is organized as follows:

docs\
examples\{README.md, hello, ..}
harper-examples\{README.md, excs, ..}
ullman-examples\{README.md, komult, mergeSort, ..}
README.md
RESOURCES.md
setenv.bat

where

We also define a virtual drive – e.g. drive K: – in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).

🔎 We use the Windows external command subst to create virtual drives; for instance:

> subst K: %USERPROFILE%\workspace\sml-examples

In the next section we give a brief description of the batch files present in this project.

Batch commands

We distinguish different sets of batch commands:

  1. setenv.bat - This batch command makes external tools such as git.exe and sh.exe directly available from the command prompt (see section Project dependencies).

    > setenv -verbose
    Tool versions:
       MLton 20241230, mosmlc 2.01, sml 110.99.6.1,
       git 2.47.1, diff 3.10, bash 5.2.37(1)
    Tool paths:
       C:\opt\mlton\bin\mlton.bat
       C:\opt\mosml\bin\mosmlc.exe
       C:\opt\SMLNJ\bin\sml.bat
       C:\opt\Git\bin\git.exe
       C:\opt\Git\usr\bin\diff.exe
       C:\opt\Git\bin\bash.exe
    Environment variables:
       "GIT_HOME=C:\opt\Git"
       "MLTON_HOME=C:\opt\mlton"
       "MOSML_HOME=C:\opt\mosml"
       "MOSMLLIB=C:\opt\mosml\lib"
       "SMLNJ_HOME=C:\opt\smlnj"
    Path associations:
       K:\: => %USERPROFILE%\workspace-perso\sml-examples
    

Footnotes

[1] Downloads

In our case we downloaded the following installation files (see section 1):
mlton-20241230-1.amd64-mingw.windows-2022_MINGW64.tgz ( 16 MB)
PortableGit-2.47.1-64-bit.7z.exe                      ( 43 MB)
smlnet.tar.gz                                         (  3 MB)
smlnj-110.99.6.1.msi                                  ( 13 MB)
VSCode-win32-x64-1.96.2.zip                           (131 MB)
win32-mos201bin.zip                                   (  2 MB)

[2] SML/NJ Installation

The Microsoft Installer package smlnj-110.99.6.1.msi is the standard way to install SML/NJ under Windows. In addition to creating the installation directory it will update the PATH environment variable and add the SMLNJ_HOME variable.

In this project we want to keep control of our environment and we just extract the installation directory SMLNJ from the installer (we define SMLNJ_HOME as a session variable) :

> msiexec /a smlnj-110.99.6.1.msi /qb TARGETDIR=%USERPROFILE%\Downloads\smlnj
> xcopy /e /i %USERPROFILE%\Downloads\smlnj\pfiles\SMLNJ C:\opt\SMLNJ
> c:\opt\SMLNJ\bin\sml -h | findstr Version
Standard ML of New Jersey [Version 110.99.6.1; 32-bit; October 25, 2024]

mics/January 2025  

About

Playing with Standard ML on Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published