Ch.5 Setting up SML# programming environment

§ 5.1. Unix-family OS,Emacs,and other tools

To enjoy writing programs, you need to set up a programming environment including

  • a good text editor, and

  • a compiler and a linker.

The environment required for SML# programming is essentially the same as in any other programming, except of course for the SML# compiler. In Java and other languages, an integrated development environment such as Eclipse is often used, but for SML# programming, we recommend the following standard system development environments.

  • OS in the Unix family. A Unix-family OS such as Linux, FreeBSD (including Mac OS) provides a rich collection of programming tools. This would be your first choice. It is easy to set up Linux on Windows using a virtual machine such as VMWare. Cygwin on Windows OS provides a similar environment.

    If you do not plan to develop a large system with various tools such as make and configure/autoconf then the combination of Emacs and MinGW (+ MSYS) on Windows would be a reasonable alternative.

  • Emacs editor. This is one of the best editor for programming, which is a repeated process of editing an ASCII text file and and compiling it. In most of the time, you are interacting with your text editor. So choosing a highly custormisable high-performance editor is important. Among various choices, we recommend one in the Emacs-family (GNU Emacs, XEmacs). Emacs is a powerful custormisable text editor, and it can also perform command execution and file system management. It requires some practice at the beginnings, but once you mastered its basic functionality, it will become a powerful tool in programming.

  • C compiler. SML# compiler generates x86 native code, creates an object file in a standard format (e.g. ELF), and generates an executable code by linking object files with C libraries. In this process, it calls C compiler deriver command such as gcc or clang. One of them should already be installed in a Unix-family OS including Cygwin and MinGW.

    If your purpose is to make a small program entirely within SML#, then you will not need to invoke a C compiler directly. However, if you want to make a paractical program, you may want to call some system library functions or you may write some part of your system in C and call that function from your ML code. This is straightforward in SML#. To exploit this feature, we recommend that you familiarize yourself with C compiler.

  • database systems. SML# seamlessly integrates SQL. SML# version 2.0.0 supports PostgreSQL, MySQL and ODBC. If you set up one of them, then you can use a database system directly within your SML# code.