Use CIT Sparc machines (arizona.princeton.edu). If you have a PC running Linux, then you should also be able to
install ML there. You can grab a copy of the compiler from the
at Bell Labs.
Edit your .cshrc or equivalent so that your path contains
Make a new directory as1 for this assignment.
Copy the files *.sml *.sig and *.cm from
directory /u/cos320/chap1/ into as1.
Please, familiarize yourself with the code that is already there. Pay
special attention to how it is divided into separate structures.
Read Chapter 1 of the textbook, Andrew Appel's "Modern Compiler
Implementation in ML," particularly pages 7-12.
Edit maxarg.sml and interp.sml (described
in the text) until they do something useful.
Inside the running ML session invoke CM.make(); to compile
Observe the compiler's messages and fix the problems that are reported. It
may be a good idea to have the ML session in a separate xterm window. You can
keep a running ML session while you are debugging. Simply type CM.make();
again when you think you have fixed the problem. This procedure saves a lot of
time, because you avoid starting ML over and over again.
Test your code by invoking Test.maxarg(); and
Test.interp(); (still within the running ML session).
If your code still does not work as intended, then debug, recompile, rerun.
Repeat as necessary.
Submit by submit 1 maxarg.sml interp.sml.
Once you are done, to further familiarize yourself with ML and with simple
interpreters you may want to spend some time extending the language and your
interpreter. The extension might add new operators for comparison (use 0 for
false and non-zero for true outcomes), and syntax that takes the "straight-line
programming language" to something with conditionals (if) or
loops (while). This does not give you extra credit immediately,
but it could help you get up to speed. Eventually it may even pay a nice
dividend when you are working on future assignments. If you are unfamiliar
with ML, play around some more. The more the better. Write a file of your
own and import it and test it in the top-level environment. To quit the
top-level environment, type ctrl-D (ctrl-Z if using SML under Windows).