配置SML/NJ
#安装
sudo apt install smlnj
#但是wsl不支持32位程序,所以需要下面配置
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 zlib1g-dev:i386
# for wsl
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic 'x7fELFx01x01x01x03x00x00x00x00x00x00x00x00x03x00x03x00x01x00x00x00' --mask 'xffxffxffxffxffxffxffxfcxffxffxffxffxffxffxffxffxf8xffxffxffxffxffxffxff'
sudo service binfmt-support start
#添加readline功能
#GNU Readline is a software library that provides line-editing and history capabilities for interactive programs with a command-line interface, such as Bash.
sudo apt-get install rlwrap #安装
#添加别名到~/.bashrc 中
alias mosml='rlwrap mosml -P full'
alias sml='rlwrap sml'
alias poly='rlwrap poly'
. ~/.bashrc #启动新的配置
#但是运行sml时发现某些指令会内存越界,觉得可能兼容的问题没有完全解决。后来在虚拟机安装smljn,一下就好了。
#smlnj想要运行sml文件可以使用如下语句
use "a.sml";
wsl安装mlkit
# 操作步骤见 : https://github.com/melsman/mlkit
# mlkit是sml吧编译器,可以将sml文件编译为对应的可执行文件
$ mlkit helloworld.sml