sml installation and run a hello world sml program
Standard ML is a modern descendant of the ML programming language which is a functional programming language developed by Robin Milner and others at the University of Edinburgh in 1973. SML appeared in 1990 with formal specification, given as typing rules and operational semantics in the The Definition of Standard ML. Its source code files are often with the extension “.sml”.
Download Standard SML from http://www.smlnj.org/
Installation for Mac Users
1. From the above site, download the mac version of Standard ML.
2. Install the dmg file you’ve downloaded, it will install it to this location
3. Make a symbolic link by the following command in the Terminal to make the SML accessible from every other directories. Note: smlnj-110.74 is the version name, it might be different from yours
sudo ln -s /usr/local/smlnj-110.74/bin/sml /usr/local/bin/sml
SML hello world program, helloworld.sml
(*This is a comment: Hello World Program*) print "Hello World, this is my first SML program!!!"
Run the helloworld sml program.
1. Assume the above code is in a file called helloworld.sml, in the same directory where the helloworld.sml lives, launch the sml by type
2. In sml console, type the following to run the program
3. To run the above code directly in the sml console, just type the above code and it will print the string.
4. To quit sml console, press Ctrl-Z
5. To run the helloworld.sml right away when you entered sml console, just add the sml file name after sml
Search within Codexpedia
Search the entire web