Download MLPolyR with Exceptions
Tarballs
- Sources as of 05/24/2007: subversion revision 883.
- Sources as of 03/19/2007: subversion revision 657.
Instructions
The compiler works on Macintosh computers running Mac OS X with Developer tools and SML/NJ installed. A recent working version of SML/NJ such as 110.63 is recommended.
To build the compiler, untar the tarball, cd into the resulting subdirectory mlpolyr, and type make. The resulting compiler can be invoked using the ./mlpolyrc command. At the moment the current directory must remain mlpolyr as mentioned above.
Usage
Unless there are type errors, the compiler will compile any file foo.mlpr to an executable foo.
- The -S flag suppresses the assembly phase, resulting in foo.s.
- Similarly, the -c flag suppresses the link phase, resulting in foo.o.
- The -PD flag causes the compiler to print the inferred types for toplevel definitions (i.e., definitions within the outermost let-expressions).
- The -PC and -PT flags cause the compiler to show the program in various intermediate forms.
Example session
Installation
$ tar xfz mlpolyr-883.tgz $ cd mlpolyr $ make (cd rt; make; cd ..) cc -arch ppc -c -O2 mlpr-rt.c all done ml-build mlpolyr.cm Main.main mlpolyr Standard ML of New Jersey v110.63.2 [built: Thu May 24 08:58:53 2007] [scanning mlpolyr.cm] [library $/ml-yacc-lib.cm is stable] [library $smlnj/viscomp/basics.cm is stable] [library $smlnj-tdp/back-trace.cm is stable] [parsing (mlpolyr.cm):machspec.sml] . . . [library $smlnj/smlnj-lib/controls-lib.cm is stable] [library $SMLNJ-LIB/Controls/controls-lib.cm is stable] all done $
Usage
$ ./mlpolyrc -PD Tests/mergesort3.mlpr
val mergesort: (('a, 'a) -/''a/-> bool, ['a]) -/''a/-> ['a]
val foldl: (('b, 'a) -/''a/-> 'a) -> 'a -> ['b] -/''a/-> 'a
val reverse: ['a] -> ['a]
val app: ('a -/''a/-> ()) -> ['a] -/''a/-> ()
val putlines: [string] -> ()
val getlines: [string] -> [string]
val stripnl: string -> string
val lt: (string, string) -> bool
val lines: [string]
val sorted_lines: [string]
$ Tests/mergesort3
alpha
beta
gamma
delta
epsilon
^D
alpha
beta
delta
epsilon
gamma
$
$ ./mlpolyrc -S Tests/mergesort3.mlpr
$ cat Tests/mergesort3.s
.globl _mlpr_entrypoint
.section __TEXT,__text,regular,pure_instructions
.align 2
_mlpr_entrypoint:
mflr r0
stw r0,8(r1)
.
.
.
.globl _mlpr_frame_info_table
.data
.align 2
_mlpr_frame_info_table:
.long l_76
.
.
.
.long 8
.long 0
$
$ ./mlpolyrc Tests/exnabc.mlpr $ Tests/exnabc A A 0 A 1 $ Tests/exnabc B B true $ Tests/exnabc C C "hello" $ Tests/exnabc D D () $ Tests/exnabc E good! $