├── regression ├── 15.ok ├── 15.sml ├── 21.ok ├── 22.ok ├── down.ok ├── id.ok ├── lex.ok ├── llv.ok ├── open.ok ├── scon.ok ├── 23.nonterm ├── abstype.ok ├── array3.ok ├── array4.ok ├── array6.ok ├── array7.ok ├── asterisk.ok ├── callcc3.ok ├── cases.ok ├── circular.ok ├── dead.nonterm ├── eq.ok ├── ex.nonterm ├── kitdangle.ok ├── kitfib35.ok ├── layout.ok ├── opaque2.ok ├── semicolon.ok ├── sharing.ok ├── tak.ok ├── textio.3.ok ├── typespec.ok ├── unary.2.ok ├── unary.ok ├── vector4.ok ├── where-and.ok ├── where.ok ├── withtype.ok ├── withtype2.ok ├── withtype3.ok ├── withtype4.ok ├── withtype5.ok ├── abcde.nonterm ├── callcc.ok ├── cycle.nonterm ├── exhaustive.ok ├── exponential.ok ├── ffi.ok ├── flat-array.4.ok ├── flexrecord.2.ok ├── flexrecord.ok ├── grow-raise.ok ├── int-inf.rep5.ok ├── kitdangle3.ok ├── mlton.overload.ok ├── nested-loop.ok ├── nonexhaustive.ok ├── overloading.ok ├── poly-equal.2.ok ├── posix-exit.ok ├── ring.ok ├── undetermined.ok ├── useless-string.ok ├── vector-loop.ok ├── vector2.ok ├── 22.sml ├── args-create.ok ├── args-spawn.ok ├── big-array.ok ├── conv.ok ├── conv2.ok ├── fact.ok ├── fast.ok ├── fast2.ok ├── flat-array.ok ├── ftruncate.ok ├── kitqsort.ok ├── known-case0.ok ├── known-case1.ok ├── lambda-list-ref.ok ├── os-exit.ok ├── pat.ok ├── ref-flatten.ok ├── rlimit.ok ├── slow.ok ├── slow2.ok ├── slower.ok ├── vector3.ok ├── 16.ok ├── 17.ok ├── 18.ok ├── 19.ok ├── 20.ok ├── bool-triple.ok ├── common-subexp0.ok ├── deep-flatten.ok ├── exn.ok ├── flat-array.2.ok ├── flat-array.3.ok ├── gc-collect2.ok ├── int-inf.0.ok ├── int-inf.3.ok ├── kitreynolds2.ok ├── kitreynolds3.ok ├── only-one-exception.nonterm ├── poly-equal.ok ├── polymorphic-recursion.ok ├── ref-flatten.2.ok ├── ref-flatten.5.ok ├── ref-flatten.6.ok ├── rem-unused.1.ok ├── same-fringe.ok ├── string2.ok ├── thread-switch.ok ├── weird-word1.ok ├── weird-word2.ok ├── constraint.ok ├── disabled │ ├── pack.ok.disabled │ ├── world2.ok.disabled │ ├── thread2.ok.disabled │ ├── timeout.ok.disabled │ ├── world3.ok.disabled │ ├── prodcons.ok.disabled │ ├── size.ok.disabled │ ├── world5.ok.disabled │ ├── weak.3.ok.disabled │ ├── thread-switch-size.ok.disabled │ ├── world6.ok.disabled │ ├── mlton.share.ok.disabled │ ├── weak.2.ok.disabled │ ├── world1.ok.disabled │ ├── weak.ok.disabled │ ├── finalize.ok.disabled │ ├── thread-switch-share.ok.disabled │ ├── finalize.2.ok.disabled │ ├── world4.ok.disabled │ ├── finalize.5.ok.disabled │ ├── finalize.3.ok.disabled │ ├── signals.ok.disabled │ ├── signals3.ok.disabled │ ├── signals4.ok.disabled │ ├── README │ ├── test-spawn.ok.disabled │ ├── finalize.4.ok.disabled │ ├── test-create.ok.disabled │ ├── mutex.ok.disabled │ └── pack.sml.disabled ├── fail │ ├── 3.sml │ ├── exp.8.sml │ ├── it.2.sml │ ├── 5.sml │ ├── exp.3.sml │ ├── exp.7.sml │ ├── it.1.sml │ ├── 4.sml │ ├── datatype.2.sml │ ├── datatype.4.sml │ ├── pat.2.sml │ ├── exception.1.sml │ ├── exp.1.sml │ ├── exp.2.sml │ ├── exp.6.sml │ ├── type.1.sml │ ├── datatype.3.sml │ ├── exp.5.sml │ ├── free-type-variable.sml │ ├── pat.3.sml │ ├── type.2.sml │ ├── exp.4.sml │ ├── structure-and.sml │ ├── datatype.1.sml │ ├── equal.sml │ ├── functor-and.sml │ ├── signature-and.sml │ ├── modules.20.sml │ ├── pat.1.sml │ ├── modules.46.sml │ ├── overloading-context.4.sml │ ├── modules.35.sml │ ├── modules.43.sml │ ├── modules.47.sml │ ├── modules.44.sml │ ├── type-use-before-def.sml │ ├── 2.sml │ ├── modules.12.sml │ ├── modules.30.sml │ ├── overloading-context.3.sml │ ├── sig.1.sml │ ├── modules.21.sml │ ├── modules.34.sml │ ├── modules.45.sml │ ├── type.sml │ ├── modules.10.sml │ ├── modules.13.sml │ ├── modules.5.sml │ ├── 1.sml │ ├── escaping-datatype.sml │ ├── modules.14.sml │ ├── tyvar-scope.1.sml │ ├── tyvar-scope.2.sml │ ├── datatype-where-complex.1.sml │ ├── modules.7.sml │ ├── modules.8.sml │ ├── sharing.sml │ ├── modules.19.sml │ ├── modules.1.sml │ ├── modules.11.sml │ ├── modules.36.sml │ ├── modules.9.sml │ ├── modules.22.sml │ ├── modules.37.sml │ ├── modules.41.sml │ ├── modules.24.sml │ ├── modules.4.sml │ ├── modules.2.sml │ ├── modules.26.sml │ ├── modules.38.sml │ ├── tyvar-scope.3.sml │ ├── overloading-context.6.sml │ ├── modules.27.sml │ ├── overloading-context.5.sml │ ├── modules.6.sml │ ├── modules.42.sml │ ├── modules.3.sml │ ├── modules.29.sml │ ├── modules.31.sml │ ├── modules.32.sml │ ├── modules.28.sml │ ├── modules.23.sml │ ├── modules.33.sml │ ├── modules.39.sml │ ├── modules.48.sml │ ├── duplicate-tyvar.sml │ ├── modules.40.sml │ ├── functor-generative-equality.sml │ ├── sig.2.sml │ ├── modules.18.sml │ ├── sharing.2.sml │ ├── modules.15.sml │ ├── modules.25.sml │ ├── modules.50.sml │ ├── eqtype.1.sml │ ├── overloading-context.1.sml │ ├── modules.49.sml │ ├── rank.sml │ └── overloading-context.2.sml ├── ffi.sml ├── gc-collect.ok ├── hello-world.ok ├── int-inf.rep1.ok ├── int-inf.rep2.ok ├── redundant.1.ok ├── ref-flatten.3.ok ├── substring-overflow.ok ├── 16.sml ├── 21.sml ├── command-line.ok ├── int-inf.4.ok ├── ref-flatten.4.ok ├── time2.ok ├── 1.sml ├── flat-vector.ok ├── 8.sml ├── callcc2.ok ├── functor.ok ├── int-inf.5.ok ├── int-inf.rep3.ok ├── int-inf.rep4.ok ├── int-overflow.ok ├── kitloop2.ok ├── valrec.ok ├── whitelist ├── 10.sml ├── 17.sml ├── hello-world.sml ├── int-inf.1.ok ├── parse.ok ├── datatype-with-free-tyvars.ok ├── wordn-array.ok ├── socket.ok ├── warn │ ├── val-rec-constructor.sml │ └── val-rec-constructor.2.sml ├── 1.ok ├── 2.ok ├── 9.sml ├── int-inf.rep3.rep32.ok ├── int-inf.rep4.rep32.ok ├── serialize.ok ├── testMatrix.ok ├── 18.sml ├── 20.sml ├── comment-end.sml ├── cmdline.ok ├── int-inf.0.sml ├── opaque.ok ├── thread0.ok ├── 11.sml ├── fft.ok ├── 12.sml ├── int-inf.rep3.rep64.ok ├── int-inf.rep4.rep64.ok ├── kitmandelbrot.ok ├── 19.sml ├── time4.ok ├── char.scan.ok ├── ieee-real.ok ├── pack-real.2.ok ├── real-decimal.1.ok ├── suspend.ok ├── kittmergesort.ok ├── common-subexp0.sml ├── gc-collect.sml ├── ieee-real.arm-linux.ok ├── listsort.ok ├── local-ref.ok ├── posix-exit.sml ├── real-str.arm-linux.ok ├── 23.sml ├── int-inf.log2.ok ├── 14.sml ├── dead.sml ├── os-exit.sml ├── asterisk.sml ├── 6.sml ├── callcc.sml ├── timer.ok ├── cycle.sml ├── fact.sml ├── lex.sml ├── testdyn2.ok ├── 2.sml ├── 3.sml ├── abcde.sml ├── big-array.sml ├── poly-equal.sml ├── string2.sml ├── eq.sml ├── vector2.sml ├── grow-raise.sml ├── library │ └── .gitignore ├── string.fromString.ok ├── vector3.sml ├── char0.sml ├── date-localOffset.ok ├── int-inf.3.sml ├── real-algsimp.ok ├── real-str.ok ├── 13.sml ├── binio.ok ├── substring-overflow.sml ├── textio.2.ok ├── only-one-exception.sml ├── exn.sml ├── kitfib35.sml ├── time3.ok ├── 7.sml ├── exponential.sml ├── fast2.sml ├── array4.sml ├── down.sml ├── mlton.overload.sml ├── semicolon.sml ├── slow2.sml ├── pack-word.ok ├── thread1.ok ├── withtype.sml ├── nonterminate │ └── 8.sml ├── tak.sml ├── exn2.sml ├── lambda-list-ref.sml ├── fast.sml ├── stringcvt.ok ├── .gitignore ├── array5.ok ├── command-line.sml ├── layout.sml ├── once.ok ├── open.sml ├── slow.sml ├── useless-string.sml ├── withtype4.sml ├── exn-history.sml ├── slower.sml ├── bool-triple.sml ├── known-case0.sml ├── scon.sml ├── 4.sml ├── fixed-integer.ok ├── pat.sml ├── array3.sml ├── known-case1.sml ├── withtype3.sml ├── deep-flatten.sml ├── int-inf.rep1.sml ├── vector-loop.sml ├── listpair.ok ├── circular.sml ├── nested-loop.sml ├── withtype2.sml ├── flat-vector.sml ├── typespec.sml ├── flat-array.3.sml ├── int-inf.rep2.sml ├── int-inf.4.sml ├── int-inf.5.sml ├── ex.sml ├── id.sml ├── print-self.ok ├── print-self.sml ├── exn-history.ok ├── taut.sml ├── date-localOffset.sml ├── unary.2.sml ├── withtype5.sml ├── array7.sml ├── FuhMishra.ok ├── array2.ok ├── date.ok ├── flat-array.2.sml ├── opaque2.sml ├── rlimit.sml └── jump.sml ├── examples ├── .gitignore ├── src │ ├── coins │ │ └── sources.mlb │ ├── dmm │ │ └── sources.mlb │ ├── fib │ │ └── sources.mlb │ ├── msort │ │ └── sources.mlb │ ├── nqueens │ │ └── sources.mlb │ ├── primes │ │ └── sources.mlb │ ├── random │ │ └── sources.mlb │ ├── reverb │ │ └── sources.mlb │ ├── tokens │ │ └── sources.mlb │ ├── nn │ │ └── sources.mlb │ ├── dedup │ │ └── sources.mlb │ ├── ray │ │ └── sources.mlb │ └── seam-carve │ │ └── sources.mlb └── lib │ ├── ForkJoin.mlton.sml │ └── sources.mlton.mlb ├── doc └── license │ ├── MLton-LICENSE │ └── .gitignore ├── lib ├── mllpt-lib │ ├── .gitignore │ ├── ml-lpt.tgz │ └── ml-lpt.patch ├── stubs │ ├── common │ │ └── basis │ │ │ ├── pervasive.sml │ │ │ ├── real32-via-real.sml │ │ │ └── real64-via-real.sml │ ├── mlton-stubs │ │ ├── array.sig │ │ ├── profile.sig │ │ ├── random.sig │ │ ├── random.sml │ │ ├── rusage.sig │ │ ├── text-io.sig │ │ ├── vector.sig │ │ ├── .gitignore │ │ ├── platform.sig │ │ ├── platform.sml │ │ ├── mlton-root.sig │ │ ├── README │ │ ├── pre-sources.cm │ │ └── exn.sig │ ├── polyml │ │ ├── mlton │ │ │ └── sources.use │ │ └── basis │ │ │ └── sources.use │ ├── mlkit │ │ ├── basis │ │ │ ├── pervasive.mlb │ │ │ ├── unsafe.mlb │ │ │ └── timer.sml │ │ └── mlton │ │ │ └── sources.mlb │ └── smlnj │ │ ├── mlton │ │ └── sources.cm │ │ └── basis │ │ └── pervasive.cm ├── smlnj-lib │ ├── .gitignore │ └── smlnj-lib.tgz ├── mlton │ ├── basic │ │ ├── inet-sock.sml │ │ ├── socket.sml │ │ ├── word8-array-slice.sml │ │ ├── word32.sml │ │ ├── itimer.sml │ │ ├── unit.sig │ │ ├── ps.sml │ │ ├── signal.sig │ │ ├── char-pred.sig │ │ ├── dynamic-wind.sml │ │ ├── signal.sml │ │ ├── mono-container.sig │ │ ├── order.sig │ │ ├── export.sig │ │ ├── t.sig │ │ ├── escape.sig │ │ ├── unit.sml │ │ ├── field.fun │ │ ├── postscript.sig │ │ ├── outstream.sml │ │ └── port.sig │ ├── directed-graph │ │ └── test.sml │ ├── queue │ │ ├── persistent.sig │ │ └── unbounded-ephemeral.sig │ └── pervasive │ │ └── sources.mlb └── .gitignore ├── mltrace ├── .gitignore ├── NOTES.md └── Makefile ├── basis-library ├── .gitignore ├── maps │ ├── objptr-rep32.map │ ├── objptr-rep64.map │ ├── seqindex-int32.map │ ├── seqindex-int64.map │ ├── normal-metadata-size32.map │ ├── normal-metadata-size64.map │ ├── normal-metadata-size128.map │ ├── sequence-metadata-size128.map │ ├── sequence-metadata-size192.map │ ├── sequence-metadata-size256.map │ └── sequence-metadata-size96.map ├── fork-join.mlb ├── libs │ ├── basis-2002 │ │ └── top-level │ │ │ ├── .gitignore │ │ │ ├── basis-equal.sig │ │ │ ├── basis.sml │ │ │ ├── pervasive-exns.sml │ │ │ ├── pervasive-vals.sml │ │ │ ├── pervasive-equal.sml │ │ │ └── pervasive-types.sml │ ├── basis-1997 │ │ ├── io │ │ │ ├── bin-stream-io.sig │ │ │ ├── text-stream-io.sig │ │ │ └── io-convert.fun │ │ ├── top-level │ │ │ ├── top-level.sml │ │ │ └── basis-funs.sml │ │ ├── posix │ │ │ ├── flags.sig │ │ │ └── posix.sig │ │ └── system │ │ │ ├── unix.sig │ │ │ └── process-convert.fun │ ├── basis-none │ │ └── top-level │ │ │ ├── top-level.sml │ │ │ ├── basis.sml │ │ │ └── infixes.sml │ └── basis-2002-strict │ │ └── top-level │ │ └── top-level.sml ├── io │ ├── bin-stream-io.sig │ └── text-stream-io.sig ├── system │ ├── command-line.sig │ └── os.sig ├── mlton │ ├── mono-array.sig │ ├── mono-vector.sig │ ├── platform-pre.sml │ ├── bin-io.sig │ ├── text-io.sig │ └── weak.sig ├── basis.mlb ├── mpl │ ├── mpl.sig │ └── mpl.sml ├── config │ ├── bind │ │ ├── int-inf-top.sml │ │ ├── int-inf-prim.sml │ │ ├── pointer-mlton.sml │ │ ├── pointer-prim.sml │ │ ├── real-top.sml │ │ ├── real-prim.sml │ │ ├── int-top.sml │ │ ├── char-prim.sml │ │ ├── word-top.sml │ │ ├── string-prim.sml │ │ ├── int-prim.sml │ │ └── word-prim.sml │ ├── metadata │ │ ├── normal-metadata-size128.sml │ │ ├── normal-metadata-size32.sml │ │ ├── normal-metadata-size64.sml │ │ ├── sequence-metadata-size128.sml │ │ ├── sequence-metadata-size192.sml │ │ ├── sequence-metadata-size256.sml │ │ └── sequence-metadata-size96.sml │ ├── c │ │ ├── position.sml │ │ └── sys-word.sml │ ├── default │ │ ├── fixed-int.sml │ │ └── large-int.sml │ └── seqindex │ │ ├── seqindex-int32.sml │ │ └── seqindex-int64.sml ├── net │ ├── net-prot-db.sig │ └── net-serv-db.sig ├── top-level │ ├── infixes-unsafe.sml │ └── infixes-overflow.sml ├── pervasive.mlb ├── integer │ ├── int-global.sml │ └── word-global.sml ├── text │ ├── char-global.sml │ └── substring-global.sml ├── general │ └── bool.sig ├── real │ └── real-global.sml └── util │ ├── unique-id.sig │ └── dynamic-wind.sig ├── bin ├── static-library.bat ├── patch-mingw ├── run-docker ├── host-os └── host-arch ├── .gitignore ├── mlton ├── control │ ├── .gitignore │ └── version_sml.src ├── front-end │ ├── .gitignore │ └── ml-yacc-lib-proxy.cm ├── atoms │ ├── spid.sig │ ├── func.sig │ ├── label.sig │ ├── var.sig │ └── tyvar.sig ├── mlton-smlnj.cm ├── backend │ ├── rssa.fun │ ├── rssa.sig │ └── rssa-simplify.sig ├── mlton.mlb ├── sources.mlb ├── call-main.sml ├── main │ └── main.sml ├── sources.cm ├── xml │ └── xml.fun └── ssa │ └── ssa2.fun ├── runtime ├── platform │ ├── hppa.h │ ├── ia64.h │ ├── m68k.h │ ├── mips.h │ ├── s390.h │ ├── x86.h │ ├── alpha.h │ ├── arm64.h │ ├── powerpc.h │ ├── riscv.h │ ├── sparc.h │ ├── wasm32.h │ ├── powerpc64.h │ ├── loongarch64.h │ ├── setenv.h │ ├── netbsd.c │ ├── amd64.h │ └── displayMem.proc.c ├── gen │ ├── basis-ffi.h.chk │ ├── basis-ffi.sml.chk │ ├── gen-basis-ffi-consts.c.chk │ └── .gitignore ├── gdtoa.tgz ├── basis │ ├── cpointer.c │ ├── Real │ │ └── Real.c │ ├── Word │ │ └── Word.c │ ├── Posix │ │ ├── Process │ │ │ ├── exit.c │ │ │ ├── alarm.c │ │ │ ├── pause.c │ │ │ ├── sleep.c │ │ │ ├── ifExited.c │ │ │ ├── ifStopped.c │ │ │ ├── termSig.c │ │ │ ├── ifSignaled.c │ │ │ ├── kill.c │ │ │ ├── system.c │ │ │ ├── stopSig.c │ │ │ ├── exitStatus.c │ │ │ ├── waitpid.c │ │ │ └── waitpid-consts.c │ │ ├── IO │ │ │ ├── dup.c │ │ │ ├── close.c │ │ │ ├── fsync.c │ │ │ ├── dup2.c │ │ │ ├── fcntl2.c │ │ │ ├── pipe.c │ │ │ ├── fcntl3.c │ │ │ ├── lseek.c │ │ │ └── lseek-consts.c │ │ ├── FileSys │ │ │ ├── umask.c │ │ │ ├── fchdir.c │ │ │ ├── chdir.c │ │ │ ├── fchmod.c │ │ │ ├── rmdir.c │ │ │ ├── ftruncate.c │ │ │ ├── unlink.c │ │ │ ├── fchown.c │ │ │ ├── fpathconf.c │ │ │ ├── open2.c │ │ │ ├── access.c │ │ │ ├── chmod.c │ │ │ ├── mkdir.c │ │ │ ├── mkfifo.c │ │ │ ├── pathconf.c │ │ │ ├── truncate.c │ │ │ ├── chown.c │ │ │ ├── open3.c │ │ │ ├── link.c │ │ │ ├── getcwd.c │ │ │ ├── symlink.c │ │ │ └── readlink.c │ │ ├── ProcEnv │ │ │ ├── isatty.c │ │ │ ├── sysconf.c │ │ │ ├── getenv.c │ │ │ ├── setgroups.c │ │ │ ├── getlogin.c │ │ │ ├── ttyname.c │ │ │ ├── environ.c │ │ │ ├── setenv.c │ │ │ └── getgroups.c │ │ └── Error.c │ ├── Net │ │ ├── NetHostDB-consts.c │ │ └── Socket │ │ │ └── INetSock-consts.c │ ├── System │ │ ├── OS │ │ │ └── IO │ │ │ │ └── poll-consts.c │ │ ├── CommandLine.c │ │ └── Time.c │ └── MLton │ │ ├── Itimer │ │ └── itimer-consts.c │ │ └── bug.c ├── .gitignore ├── gc │ ├── model.c │ ├── gdtoa-multiple-threads-defs.h │ ├── gap.h │ ├── done.h │ └── string.c └── util │ └── to-string.h ├── docs ├── .gitignore ├── assets │ ├── forward.png │ ├── header.png │ ├── heap-query.png │ ├── heap-obj-model.png │ └── heap-obj-types.png ├── compiler │ └── index.md └── rts │ ├── mm │ ├── read-barrier.md │ ├── stack.md │ ├── obj-type-table.md │ ├── cgc.md │ └── index.md │ ├── em │ └── index.md │ ├── index.md │ └── sched │ └── index.md └── docker-bake.hcl /regression/15.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/15.sml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/21.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/22.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/down.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/id.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/lex.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/llv.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/open.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/scon.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/23.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/abstype.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/array3.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/array4.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/array6.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/array7.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/asterisk.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/callcc3.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/cases.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/circular.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/dead.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/eq.ok: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /regression/ex.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/kitdangle.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/kitfib35.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/layout.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/opaque2.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/semicolon.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/sharing.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/tak.ok: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /regression/textio.3.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/typespec.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/unary.2.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/unary.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/vector4.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/where-and.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/where.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/withtype.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/withtype2.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/withtype3.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/withtype4.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/withtype5.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | -------------------------------------------------------------------------------- /regression/abcde.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/callcc.ok: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /regression/cycle.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/exhaustive.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/exponential.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/ffi.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /regression/flat-array.4.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/flexrecord.2.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/flexrecord.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/grow-raise.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/int-inf.rep5.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/kitdangle3.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/mlton.overload.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/nested-loop.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/nonexhaustive.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/overloading.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/poly-equal.2.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/posix-exit.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/ring.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /regression/undetermined.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/useless-string.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/vector-loop.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/vector2.ok: -------------------------------------------------------------------------------- 1 | 6 2 | -------------------------------------------------------------------------------- /regression/22.sml: -------------------------------------------------------------------------------- 1 | val _ = () 2 | -------------------------------------------------------------------------------- /regression/args-create.ok: -------------------------------------------------------------------------------- 1 | OK! 2 | -------------------------------------------------------------------------------- /regression/args-spawn.ok: -------------------------------------------------------------------------------- 1 | OK! 2 | -------------------------------------------------------------------------------- /regression/big-array.ok: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /regression/conv.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/conv2.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/fact.ok: -------------------------------------------------------------------------------- 1 | 3628800 2 | -------------------------------------------------------------------------------- /regression/fast.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/fast2.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/flat-array.ok: -------------------------------------------------------------------------------- 1 | 0 3 2 | -------------------------------------------------------------------------------- /regression/ftruncate.ok: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /regression/kitqsort.ok: -------------------------------------------------------------------------------- 1 | Ok! 2 | -------------------------------------------------------------------------------- /regression/known-case0.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /regression/known-case1.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /regression/lambda-list-ref.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/os-exit.ok: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /regression/pat.ok: -------------------------------------------------------------------------------- 1 | hello world 2 | -------------------------------------------------------------------------------- /regression/ref-flatten.ok: -------------------------------------------------------------------------------- 1 | 44 2 | -------------------------------------------------------------------------------- /regression/rlimit.ok: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /regression/slow.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/slow2.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/slower.ok: -------------------------------------------------------------------------------- 1 | All ok 2 | -------------------------------------------------------------------------------- /regression/vector3.ok: -------------------------------------------------------------------------------- 1 | 1000 2 | -------------------------------------------------------------------------------- /doc/license/MLton-LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /lib/mllpt-lib/.gitignore: -------------------------------------------------------------------------------- 1 | /ml-lpt/ 2 | -------------------------------------------------------------------------------- /lib/stubs/common/basis/pervasive.sml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/16.ok: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /regression/17.ok: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /regression/18.ok: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /regression/19.ok: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /regression/20.ok: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /regression/bool-triple.ok: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /regression/common-subexp0.ok: -------------------------------------------------------------------------------- 1 | nan 2 | -------------------------------------------------------------------------------- /regression/deep-flatten.ok: -------------------------------------------------------------------------------- 1 | 5 6 2 | -------------------------------------------------------------------------------- /regression/exn.ok: -------------------------------------------------------------------------------- 1 | zzzzzzzzzzzzz 2 | -------------------------------------------------------------------------------- /regression/flat-array.2.ok: -------------------------------------------------------------------------------- 1 | 12 14 2 | -------------------------------------------------------------------------------- /regression/flat-array.3.ok: -------------------------------------------------------------------------------- 1 | 2 101 2 | -------------------------------------------------------------------------------- /regression/gc-collect2.ok: -------------------------------------------------------------------------------- 1 | 60480 2 | -------------------------------------------------------------------------------- /regression/int-inf.0.ok: -------------------------------------------------------------------------------- 1 | 2147483648 2 | -------------------------------------------------------------------------------- /regression/int-inf.3.ok: -------------------------------------------------------------------------------- 1 | true12345 2 | -------------------------------------------------------------------------------- /regression/kitreynolds2.ok: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /regression/kitreynolds3.ok: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /regression/only-one-exception.nonterm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/poly-equal.ok: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /regression/polymorphic-recursion.ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /regression/ref-flatten.2.ok: -------------------------------------------------------------------------------- 1 | 71 EC 2 | -------------------------------------------------------------------------------- /regression/ref-flatten.5.ok: -------------------------------------------------------------------------------- 1 | 59 2 | -------------------------------------------------------------------------------- /regression/ref-flatten.6.ok: -------------------------------------------------------------------------------- 1 | hi 2 | -------------------------------------------------------------------------------- /regression/rem-unused.1.ok: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /regression/same-fringe.ok: -------------------------------------------------------------------------------- 1 | success 2 | -------------------------------------------------------------------------------- /regression/string2.ok: -------------------------------------------------------------------------------- 1 | \000\000 2 | -------------------------------------------------------------------------------- /regression/thread-switch.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /regression/weird-word1.ok: -------------------------------------------------------------------------------- 1 | 0wx8 2 | -------------------------------------------------------------------------------- /regression/weird-word2.ok: -------------------------------------------------------------------------------- 1 | 0wx8 2 | -------------------------------------------------------------------------------- /lib/smlnj-lib/.gitignore: -------------------------------------------------------------------------------- 1 | /smlnj-lib/ 2 | -------------------------------------------------------------------------------- /regression/constraint.ok: -------------------------------------------------------------------------------- 1 | A(hello,5) 2 | -------------------------------------------------------------------------------- /regression/disabled/pack.ok.disabled: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /regression/fail/3.sml: -------------------------------------------------------------------------------- 1 | type t = 'a * 'b 2 | -------------------------------------------------------------------------------- /regression/fail/exp.8.sml: -------------------------------------------------------------------------------- 1 | exception nil 2 | -------------------------------------------------------------------------------- /regression/fail/it.2.sml: -------------------------------------------------------------------------------- 1 | exception it 2 | -------------------------------------------------------------------------------- /regression/ffi.sml: -------------------------------------------------------------------------------- 1 | val _ = print "ok\n" 2 | -------------------------------------------------------------------------------- /regression/gc-collect.ok: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /regression/hello-world.ok: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /regression/int-inf.rep1.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | -------------------------------------------------------------------------------- /regression/int-inf.rep2.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | -------------------------------------------------------------------------------- /regression/redundant.1.ok: -------------------------------------------------------------------------------- 1 | 1 2 3 5 6 7 2 | -------------------------------------------------------------------------------- /regression/ref-flatten.3.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | -------------------------------------------------------------------------------- /regression/substring-overflow.ok: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /doc/license/.gitignore: -------------------------------------------------------------------------------- 1 | /SMLNJ-LIB-LICENSE 2 | -------------------------------------------------------------------------------- /mltrace/.gitignore: -------------------------------------------------------------------------------- 1 | tracetr.o 2 | tracetr 3 | -------------------------------------------------------------------------------- /regression/16.sml: -------------------------------------------------------------------------------- 1 | print "Hello, World!\n"; 2 | -------------------------------------------------------------------------------- /regression/21.sml: -------------------------------------------------------------------------------- 1 | val 'a rec f = fn x => x 2 | -------------------------------------------------------------------------------- /regression/command-line.ok: -------------------------------------------------------------------------------- 1 | ./command-line 2 | -------------------------------------------------------------------------------- /regression/disabled/world2.ok.disabled: -------------------------------------------------------------------------------- 1 | 30 2 | -------------------------------------------------------------------------------- /regression/fail/5.sml: -------------------------------------------------------------------------------- 1 | datatype t = A | = 2 | -------------------------------------------------------------------------------- /regression/fail/exp.3.sml: -------------------------------------------------------------------------------- 1 | fun f x x = 13 2 | -------------------------------------------------------------------------------- /regression/fail/exp.7.sml: -------------------------------------------------------------------------------- 1 | fun nil () = () 2 | -------------------------------------------------------------------------------- /regression/fail/it.1.sml: -------------------------------------------------------------------------------- 1 | datatype t = it 2 | -------------------------------------------------------------------------------- /regression/int-inf.4.ok: -------------------------------------------------------------------------------- 1 | 09876543210987654321 2 | -------------------------------------------------------------------------------- /regression/ref-flatten.4.ok: -------------------------------------------------------------------------------- 1 | NONE 2 | SOME 9 3 | -------------------------------------------------------------------------------- /regression/time2.ok: -------------------------------------------------------------------------------- 1 | OK 2 | OK 3 | OK 4 | OK 5 | -------------------------------------------------------------------------------- /basis-library/.gitignore: -------------------------------------------------------------------------------- 1 | /basis-library.def-use 2 | -------------------------------------------------------------------------------- /regression/1.sml: -------------------------------------------------------------------------------- 1 | val _ = raise raise Overflow 2 | -------------------------------------------------------------------------------- /regression/disabled/thread2.ok.disabled: -------------------------------------------------------------------------------- 1 | success 2 | -------------------------------------------------------------------------------- /regression/disabled/timeout.ok.disabled: -------------------------------------------------------------------------------- 1 | success 2 | -------------------------------------------------------------------------------- /regression/disabled/world3.ok.disabled: -------------------------------------------------------------------------------- 1 | caught foo 2 | -------------------------------------------------------------------------------- /regression/fail/4.sml: -------------------------------------------------------------------------------- 1 | datatype foo = Foo of 'a 2 | -------------------------------------------------------------------------------- /regression/fail/datatype.2.sml: -------------------------------------------------------------------------------- 1 | datatype t = A | A 2 | -------------------------------------------------------------------------------- /regression/fail/datatype.4.sml: -------------------------------------------------------------------------------- 1 | datatype t = nil 2 | -------------------------------------------------------------------------------- /regression/fail/pat.2.sml: -------------------------------------------------------------------------------- 1 | val {x, x} = {x = 13} 2 | -------------------------------------------------------------------------------- /regression/flat-vector.ok: -------------------------------------------------------------------------------- 1 | should be 08 2 | 08 3 | -------------------------------------------------------------------------------- /basis-library/maps/objptr-rep32.map: -------------------------------------------------------------------------------- 1 | OBJPTR_REP rep32 2 | -------------------------------------------------------------------------------- /basis-library/maps/objptr-rep64.map: -------------------------------------------------------------------------------- 1 | OBJPTR_REP rep64 2 | -------------------------------------------------------------------------------- /bin/static-library.bat: -------------------------------------------------------------------------------- 1 | @bash %~dp0static-library %* 2 | -------------------------------------------------------------------------------- /regression/8.sml: -------------------------------------------------------------------------------- 1 | val _ = {hello = true, 1 = "yes"} 2 | -------------------------------------------------------------------------------- /regression/callcc2.ok: -------------------------------------------------------------------------------- 1 | Fun 2 | Fun 3 | Code 4 | Fun 5 | -------------------------------------------------------------------------------- /regression/disabled/prodcons.ok.disabled: -------------------------------------------------------------------------------- 1 | 100000 100000 2 | -------------------------------------------------------------------------------- /regression/fail/exception.1.sml: -------------------------------------------------------------------------------- 1 | exception E 2 | and E 3 | -------------------------------------------------------------------------------- /regression/fail/exp.1.sml: -------------------------------------------------------------------------------- 1 | val _ = {x = 13, x = 14} 2 | -------------------------------------------------------------------------------- /regression/fail/exp.2.sml: -------------------------------------------------------------------------------- 1 | val x = 13 2 | and x = (); 3 | -------------------------------------------------------------------------------- /regression/fail/exp.6.sml: -------------------------------------------------------------------------------- 1 | val rec nil = fn () => () 2 | -------------------------------------------------------------------------------- /regression/fail/type.1.sml: -------------------------------------------------------------------------------- 1 | type t = {x: int, x: real} 2 | -------------------------------------------------------------------------------- /regression/functor.ok: -------------------------------------------------------------------------------- 1 | value is A(K) 2 | value is A(J) 3 | -------------------------------------------------------------------------------- /regression/int-inf.5.ok: -------------------------------------------------------------------------------- 1 | 5 2 | 5 3 | 500000000 4 | 1 5 | -------------------------------------------------------------------------------- /regression/int-inf.rep3.ok: -------------------------------------------------------------------------------- 1 | int-inf.rep3.???.ok missing 2 | -------------------------------------------------------------------------------- /regression/int-inf.rep4.ok: -------------------------------------------------------------------------------- 1 | int-inf.rep4.???.ok missing 2 | -------------------------------------------------------------------------------- /regression/int-overflow.ok: -------------------------------------------------------------------------------- 1 | OK 2 | OK 3 | OK 4 | OK 5 | -------------------------------------------------------------------------------- /regression/kitloop2.ok: -------------------------------------------------------------------------------- 1 | 2 | looping... 3 | 4 | done 5 | -------------------------------------------------------------------------------- /regression/valrec.ok: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | Hello, world! 3 | -------------------------------------------------------------------------------- /regression/whitelist: -------------------------------------------------------------------------------- 1 | ieee-real 2 | real 3 | real-str 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /boot/ 2 | /build/ 3 | /install/ 4 | mlton-*.tgz 5 | -------------------------------------------------------------------------------- /basis-library/fork-join.mlb: -------------------------------------------------------------------------------- 1 | schedulers/spork/sources.mlb 2 | -------------------------------------------------------------------------------- /basis-library/maps/seqindex-int32.map: -------------------------------------------------------------------------------- 1 | SEQINDEX_INT int32 2 | -------------------------------------------------------------------------------- /basis-library/maps/seqindex-int64.map: -------------------------------------------------------------------------------- 1 | SEQINDEX_INT int64 2 | -------------------------------------------------------------------------------- /lib/mlton/basic/inet-sock.sml: -------------------------------------------------------------------------------- 1 | structure INetSock = INetSock 2 | -------------------------------------------------------------------------------- /mlton/control/.gitignore: -------------------------------------------------------------------------------- 1 | /version.sml 2 | /version_sml.chk 3 | -------------------------------------------------------------------------------- /regression/10.sml: -------------------------------------------------------------------------------- 1 | val {...} = {hello = true, no = "no"} 2 | -------------------------------------------------------------------------------- /regression/17.sml: -------------------------------------------------------------------------------- 1 | print "Hello,"; 2 | print " World!\n"; 3 | -------------------------------------------------------------------------------- /regression/disabled/size.ok.disabled: -------------------------------------------------------------------------------- 1 | size.???.ok missing 2 | -------------------------------------------------------------------------------- /regression/disabled/world5.ok.disabled: -------------------------------------------------------------------------------- 1 | success 2 | success 3 | -------------------------------------------------------------------------------- /regression/fail/datatype.3.sml: -------------------------------------------------------------------------------- 1 | datatype t = A 2 | and u = A 3 | -------------------------------------------------------------------------------- /regression/fail/exp.5.sml: -------------------------------------------------------------------------------- 1 | fun f () = () 2 | and f () = () 3 | -------------------------------------------------------------------------------- /regression/fail/free-type-variable.sml: -------------------------------------------------------------------------------- 1 | datatype t = T of 'a 2 | -------------------------------------------------------------------------------- /regression/fail/pat.3.sml: -------------------------------------------------------------------------------- 1 | val {x = y, x = z} = {x = 13}; 2 | -------------------------------------------------------------------------------- /regression/fail/type.2.sml: -------------------------------------------------------------------------------- 1 | type t = int 2 | and t = real 3 | -------------------------------------------------------------------------------- /regression/hello-world.sml: -------------------------------------------------------------------------------- 1 | val _ = print "Hello, world!\n" 2 | -------------------------------------------------------------------------------- /regression/int-inf.1.ok: -------------------------------------------------------------------------------- 1 | trying 0 2 | ok 3 | trying 1 4 | ok 5 | -------------------------------------------------------------------------------- /regression/parse.ok: -------------------------------------------------------------------------------- 1 | The name of the structure is: MyStruct 2 | -------------------------------------------------------------------------------- /examples/src/coins/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | coins.sml -------------------------------------------------------------------------------- /examples/src/dmm/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/fib/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /lib/mlton/basic/socket.sml: -------------------------------------------------------------------------------- 1 | structure Socket = Pervasive.Socket 2 | -------------------------------------------------------------------------------- /regression/datatype-with-free-tyvars.ok: -------------------------------------------------------------------------------- 1 | true 13 2 | false foo 3 | -------------------------------------------------------------------------------- /regression/disabled/weak.3.ok.disabled: -------------------------------------------------------------------------------- 1 | 6 2 | 5 3 | 4 4 | 3 5 | 2 6 | -------------------------------------------------------------------------------- /regression/wordn-array.ok: -------------------------------------------------------------------------------- 1 | 9 2 | 9 3 | 9 4 | 9 5 | 9 6 | 9 7 | 9 8 | -------------------------------------------------------------------------------- /runtime/platform/hppa.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "hppa" 2 | -------------------------------------------------------------------------------- /runtime/platform/ia64.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "ia64" 2 | -------------------------------------------------------------------------------- /runtime/platform/m68k.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "m68k" 2 | -------------------------------------------------------------------------------- /runtime/platform/mips.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "mips" 2 | -------------------------------------------------------------------------------- /runtime/platform/s390.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "s390" 2 | -------------------------------------------------------------------------------- /runtime/platform/x86.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "x86" 2 | -------------------------------------------------------------------------------- /examples/src/msort/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/nqueens/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/primes/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/random/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/reverb/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /examples/src/tokens/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | main.sml 3 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/array.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/array.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/profile.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/profile.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/random.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/random.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/random.sml: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/random.sml -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/rusage.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/rusage.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/text-io.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/text-io.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/vector.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/vector.sig -------------------------------------------------------------------------------- /regression/disabled/thread-switch-size.ok.disabled: -------------------------------------------------------------------------------- 1 | !rs > 0 = true 2 | -------------------------------------------------------------------------------- /regression/disabled/world6.ok.disabled: -------------------------------------------------------------------------------- 1 | ./world6 2 | a 3 | b 4 | c 5 | -------------------------------------------------------------------------------- /regression/socket.ok: -------------------------------------------------------------------------------- 1 | OK 2 | hello, world 3 | NONE 4 | goodbye, world 5 | -------------------------------------------------------------------------------- /regression/warn/val-rec-constructor.sml: -------------------------------------------------------------------------------- 1 | val rec NONE = fn () => () 2 | -------------------------------------------------------------------------------- /runtime/gen/basis-ffi.h.chk: -------------------------------------------------------------------------------- 1 | 1276d591e8e38dacd91962c79e765101435fadfc 2 | -------------------------------------------------------------------------------- /runtime/platform/alpha.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "alpha" 2 | -------------------------------------------------------------------------------- /runtime/platform/arm64.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "arm64" 2 | -------------------------------------------------------------------------------- /runtime/platform/powerpc.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "powerpc" 2 | -------------------------------------------------------------------------------- /runtime/platform/riscv.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "riscv" 2 | -------------------------------------------------------------------------------- /runtime/platform/sparc.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "sparc" 2 | -------------------------------------------------------------------------------- /runtime/platform/wasm32.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "wasm32" 2 | -------------------------------------------------------------------------------- /basis-library/maps/normal-metadata-size32.map: -------------------------------------------------------------------------------- 1 | NORMAL_METADATA_SIZE size32 2 | -------------------------------------------------------------------------------- /basis-library/maps/normal-metadata-size64.map: -------------------------------------------------------------------------------- 1 | NORMAL_METADATA_SIZE size64 2 | -------------------------------------------------------------------------------- /examples/src/nn/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | NN.sml 3 | main.sml 4 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/.gitignore: -------------------------------------------------------------------------------- 1 | /pre-mlton.sml 2 | /pre-mlton_sml.chk 3 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/platform.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/platform.sig -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/platform.sml: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/platform.sml -------------------------------------------------------------------------------- /regression/1.ok: -------------------------------------------------------------------------------- 1 | unhandled exception: Overflow 2 | Nonzero exit status. 3 | -------------------------------------------------------------------------------- /regression/2.ok: -------------------------------------------------------------------------------- 1 | unhandled exception: Overflow 2 | Nonzero exit status. 3 | -------------------------------------------------------------------------------- /regression/9.sml: -------------------------------------------------------------------------------- 1 | fun 'a f (x: 'a): 'a = x 2 | 3 | val y: int -> int = f 4 | -------------------------------------------------------------------------------- /regression/disabled/mlton.share.ok.disabled: -------------------------------------------------------------------------------- 1 | mlton.share.???.ok missing 2 | -------------------------------------------------------------------------------- /regression/disabled/weak.2.ok.disabled: -------------------------------------------------------------------------------- 1 | 18 2 | true 3 | 19 4 | 20 5 | true 6 | -------------------------------------------------------------------------------- /regression/fail/exp.4.sml: -------------------------------------------------------------------------------- 1 | val rec x = fn () => () 2 | and x = fn () => () 3 | -------------------------------------------------------------------------------- /regression/fail/structure-and.sml: -------------------------------------------------------------------------------- 1 | structure S = struct end 2 | and S' = S 3 | -------------------------------------------------------------------------------- /regression/int-inf.rep3.rep32.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | 4294967296 3 | 4294967296 4 | -------------------------------------------------------------------------------- /regression/int-inf.rep4.rep32.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | 4294967296 3 | 4294967296 4 | -------------------------------------------------------------------------------- /regression/serialize.ok: -------------------------------------------------------------------------------- 1 | true 2 | 1 2 3 4 3 | true 4 | true 5 | 13 15 6 | -------------------------------------------------------------------------------- /regression/testMatrix.ok: -------------------------------------------------------------------------------- 1 | {x = 1, y = 2, z = 3} 2 | {x = 3, y = 5, z = 7} 3 | -------------------------------------------------------------------------------- /runtime/gen/basis-ffi.sml.chk: -------------------------------------------------------------------------------- 1 | 02ef705fb757d57053447fbdcc28cf9894f40c5f 2 | -------------------------------------------------------------------------------- /runtime/platform/powerpc64.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "powerpc64" 2 | -------------------------------------------------------------------------------- /basis-library/maps/normal-metadata-size128.map: -------------------------------------------------------------------------------- 1 | NORMAL_METADATA_SIZE size128 2 | -------------------------------------------------------------------------------- /basis-library/maps/sequence-metadata-size128.map: -------------------------------------------------------------------------------- 1 | SEQUENCE_METADATA_SIZE size128 2 | -------------------------------------------------------------------------------- /basis-library/maps/sequence-metadata-size192.map: -------------------------------------------------------------------------------- 1 | SEQUENCE_METADATA_SIZE size192 2 | -------------------------------------------------------------------------------- /basis-library/maps/sequence-metadata-size256.map: -------------------------------------------------------------------------------- 1 | SEQUENCE_METADATA_SIZE size256 2 | -------------------------------------------------------------------------------- /basis-library/maps/sequence-metadata-size96.map: -------------------------------------------------------------------------------- 1 | SEQUENCE_METADATA_SIZE size96 2 | -------------------------------------------------------------------------------- /examples/src/dedup/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | Dedup.sml 3 | main.sml 4 | -------------------------------------------------------------------------------- /examples/src/ray/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | Ray.sml 3 | main.sml 4 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/mlton-root.sig: -------------------------------------------------------------------------------- 1 | ../../../basis-library/mlton/mlton-root.sig -------------------------------------------------------------------------------- /regression/18.sml: -------------------------------------------------------------------------------- 1 | print "Hello,"; 2 | val _ = print " "; 3 | print "World!\n"; 4 | -------------------------------------------------------------------------------- /regression/20.sml: -------------------------------------------------------------------------------- 1 | structure S = struct end; 2 | print "Hello, World!\n"; 3 | 4 | -------------------------------------------------------------------------------- /regression/comment-end.sml: -------------------------------------------------------------------------------- 1 | val ** = 13 2 | val x = ( **) 3 | val _ = 1 + ** + x 4 | -------------------------------------------------------------------------------- /regression/disabled/world1.ok.disabled: -------------------------------------------------------------------------------- 1 | I am the original 2 | I am the clone 3 | -------------------------------------------------------------------------------- /regression/fail/datatype.1.sml: -------------------------------------------------------------------------------- 1 | datatype t = T of int * t 2 | withtype t = real 3 | -------------------------------------------------------------------------------- /regression/fail/equal.sml: -------------------------------------------------------------------------------- 1 | val op = = () 2 | 3 | val rec (op =) = fn _ => 13 4 | -------------------------------------------------------------------------------- /regression/fail/functor-and.sml: -------------------------------------------------------------------------------- 1 | functor F () = struct end 2 | and F' () = F () 3 | -------------------------------------------------------------------------------- /regression/fail/signature-and.sml: -------------------------------------------------------------------------------- 1 | signature SIG = sig end 2 | and SIG' = SIG 3 | -------------------------------------------------------------------------------- /runtime/gdtoa.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/runtime/gdtoa.tgz -------------------------------------------------------------------------------- /runtime/gen/gen-basis-ffi-consts.c.chk: -------------------------------------------------------------------------------- 1 | a0f2e632f508a924fd4c3461ed96c54bd6c7dd1c 2 | -------------------------------------------------------------------------------- /runtime/platform/loongarch64.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "loongarch64" 2 | -------------------------------------------------------------------------------- /lib/mlton/basic/word8-array-slice.sml: -------------------------------------------------------------------------------- 1 | structure Word8ArraySlice = Word8ArraySlice 2 | -------------------------------------------------------------------------------- /regression/cmdline.ok: -------------------------------------------------------------------------------- 1 | This program is invoked as `./cmdline' 2 | with arguments: 3 | -------------------------------------------------------------------------------- /regression/disabled/weak.ok.disabled: -------------------------------------------------------------------------------- 1 | 13 2 | 12345678901234567890 3 | 1 4 | 12345 5 | -------------------------------------------------------------------------------- /regression/fail/modules.20.sml: -------------------------------------------------------------------------------- 1 | functor F (type t) = struct fun f (x: t) = x = x end 2 | -------------------------------------------------------------------------------- /regression/fail/pat.1.sml: -------------------------------------------------------------------------------- 1 | val _ = 2 | case 13.0 of 3 | 14.0 => () 4 | ; 5 | -------------------------------------------------------------------------------- /regression/int-inf.0.sml: -------------------------------------------------------------------------------- 1 | val _ = print (concat [IntInf.toString 0x80000000, "\n"]) 2 | -------------------------------------------------------------------------------- /regression/opaque.ok: -------------------------------------------------------------------------------- 1 | f.a = 232 2 | g.A = A 3 | g.B = B 4 | h.b = 343 5 | i.c = (A,C) 6 | -------------------------------------------------------------------------------- /regression/thread0.ok: -------------------------------------------------------------------------------- 1 | 1 succeeded 2 | 2 succeeded 3 | 3 succeeded 4 | 4 succeeded 5 | -------------------------------------------------------------------------------- /regression/warn/val-rec-constructor.2.sml: -------------------------------------------------------------------------------- 1 | val rec SOME = fn _ => raise Fail "foo" 2 | -------------------------------------------------------------------------------- /runtime/basis/cpointer.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | #include "basis/cpointer.h" 4 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-cache 4 | .jekyll-metadata 5 | vendor 6 | -------------------------------------------------------------------------------- /docs/assets/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/docs/assets/forward.png -------------------------------------------------------------------------------- /docs/assets/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/docs/assets/header.png -------------------------------------------------------------------------------- /regression/11.sml: -------------------------------------------------------------------------------- 1 | val _ = let val x = SOME [] in (valOf x = [1], valOf x = [true]) end 2 | -------------------------------------------------------------------------------- /regression/fail/modules.46.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | exception it 4 | end 5 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.4.sml: -------------------------------------------------------------------------------- 1 | val x = 0.0 2 | ; 3 | val _ = x: Real32.real 4 | -------------------------------------------------------------------------------- /regression/fft.ok: -------------------------------------------------------------------------------- 1 | 2 | fft by Torben Mogensen (torbenm@diku.dk) 3 | 4 | fft'ing... done 5 | -------------------------------------------------------------------------------- /runtime/basis/Real/Real.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | #include "basis/Real/Real-ops.h" 4 | -------------------------------------------------------------------------------- /runtime/basis/Word/Word.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | #include "basis/Word/Word-ops.h" 4 | -------------------------------------------------------------------------------- /docs/compiler/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Compiler 4 | --- 5 | 6 | {: .todo} 7 | ... -------------------------------------------------------------------------------- /lib/mllpt-lib/ml-lpt.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/lib/mllpt-lib/ml-lpt.tgz -------------------------------------------------------------------------------- /regression/12.sml: -------------------------------------------------------------------------------- 1 | fun f x = x 2 | val _ = f (0w1: Word8.word) 3 | val _ = f (0w1: Word.word) 4 | -------------------------------------------------------------------------------- /regression/fail/modules.35.sml: -------------------------------------------------------------------------------- 1 | functor F (ZZZ: sig end) = struct end 2 | structure Z = ZZZ 3 | -------------------------------------------------------------------------------- /regression/fail/modules.43.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type ('a , 'a) t 4 | end 5 | -------------------------------------------------------------------------------- /regression/fail/modules.47.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | val true: bool 4 | end 5 | -------------------------------------------------------------------------------- /regression/int-inf.rep3.rep64.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | 18446744073709551616 3 | 18446744073709551616 4 | -------------------------------------------------------------------------------- /regression/int-inf.rep4.rep64.ok: -------------------------------------------------------------------------------- 1 | That's good 2 | 18446744073709551616 3 | 18446744073709551616 4 | -------------------------------------------------------------------------------- /regression/kitmandelbrot.ok: -------------------------------------------------------------------------------- 1 | 4194304 iterations 2 | 4194304 iterations 3 | 4194304 iterations 4 | -------------------------------------------------------------------------------- /runtime/platform/setenv.h: -------------------------------------------------------------------------------- 1 | int setenv (const char *name, const char *value, int overwrite); 2 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/.gitignore: -------------------------------------------------------------------------------- 1 | /generate-overloads 2 | /generate-overloads.exe 3 | -------------------------------------------------------------------------------- /docs/assets/heap-query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/docs/assets/heap-query.png -------------------------------------------------------------------------------- /lib/smlnj-lib/smlnj-lib.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/lib/smlnj-lib/smlnj-lib.tgz -------------------------------------------------------------------------------- /regression/19.sml: -------------------------------------------------------------------------------- 1 | print "Hello,"; 2 | val _ = print " "; 3 | print "World!"; 4 | val _ = print "\n" 5 | -------------------------------------------------------------------------------- /regression/disabled/finalize.ok.disabled: -------------------------------------------------------------------------------- 1 | 3 gone. 2 | 2 gone. 3 | 1 4 | 1 gone. 5 | 0 6 | 0 gone. 7 | -------------------------------------------------------------------------------- /regression/disabled/thread-switch-share.ok.disabled: -------------------------------------------------------------------------------- 1 | size1 >= size2 = true 2 | sum1 = sum2 = true 3 | -------------------------------------------------------------------------------- /regression/fail/modules.44.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | datatype t = T of 'a 4 | end 5 | -------------------------------------------------------------------------------- /regression/fail/type-use-before-def.sml: -------------------------------------------------------------------------------- 1 | val r = ref NONE 2 | datatype t = T 3 | val _ = r := SOME T 4 | -------------------------------------------------------------------------------- /regression/time4.ok: -------------------------------------------------------------------------------- 1 | 0.417 2 | 0.999 3 | 0.417 4 | 0.999 5 | ~0.417 6 | ~0.999 7 | ~0.417 8 | ~0.999 9 | -------------------------------------------------------------------------------- /docs/assets/heap-obj-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/docs/assets/heap-obj-model.png -------------------------------------------------------------------------------- /docs/assets/heap-obj-types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPLLang/mpl/HEAD/docs/assets/heap-obj-types.png -------------------------------------------------------------------------------- /regression/char.scan.ok: -------------------------------------------------------------------------------- 1 | false 2 | a at 4 of 4 3 | a at 4 of 4 4 | a at 7 of 7 5 | a at 7 of 7 6 | NONE 7 | -------------------------------------------------------------------------------- /regression/fail/2.sml: -------------------------------------------------------------------------------- 1 | val _ = 2 | let val x = ref [] 3 | in (!x = [1], !x = [true]) 4 | end 5 | -------------------------------------------------------------------------------- /regression/ieee-real.ok: -------------------------------------------------------------------------------- 1 | 3FB9999999999999 2 | 3FB999999999999A 3 | 3FB999999999999A 4 | 3FB9999999999999 5 | -------------------------------------------------------------------------------- /regression/pack-real.2.ok: -------------------------------------------------------------------------------- 1 | 576.105263158 2 | 576.105263158 3 | 9.93985099471E~242 4 | 9.93985099471E~242 5 | -------------------------------------------------------------------------------- /regression/real-decimal.1.ok: -------------------------------------------------------------------------------- 1 | minusIEEENan = ~nan 2 | signBit (valOf (fromDecimal minusIEEENan)) = true 3 | -------------------------------------------------------------------------------- /regression/suspend.ok: -------------------------------------------------------------------------------- 1 | child suspending 2 | parent sending int 3 | child got an int 4 | done 5 | done 6 | -------------------------------------------------------------------------------- /lib/stubs/polyml/mlton/sources.use: -------------------------------------------------------------------------------- 1 | use "../../common/mlton/process-via-fork-exec.sml"; 2 | use "mlton.sml"; 3 | -------------------------------------------------------------------------------- /regression/fail/modules.12.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type 'a t 4 | end where type t = int 5 | -------------------------------------------------------------------------------- /regression/fail/modules.30.sml: -------------------------------------------------------------------------------- 1 | structure S:> sig type t end = struct type t = unit end 2 | val _ = (): S.t 3 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.3.sml: -------------------------------------------------------------------------------- 1 | val x = 0w0 2 | signature S = sig end 3 | val _ = x: Word8.word 4 | -------------------------------------------------------------------------------- /regression/fail/sig.1.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | datatype t = A 4 | and u = A 5 | end 6 | -------------------------------------------------------------------------------- /regression/kittmergesort.ok: -------------------------------------------------------------------------------- 1 | 2 | List generated 3 | Doing tmergesort... 4 | Sorted 50000 5 | numbers 6 | 7 | -------------------------------------------------------------------------------- /examples/src/seam-carve/sources.mlb: -------------------------------------------------------------------------------- 1 | ../../lib/sources.mlb 2 | VerticalSeamIndexMap.sml 3 | SCI.sml 4 | main.sml 5 | -------------------------------------------------------------------------------- /regression/common-subexp0.sml: -------------------------------------------------------------------------------- 1 | val x = !(ref 0.0) / !(ref 0.0) 2 | val _ = print (concat [Real.toString x, "\n"]) 3 | -------------------------------------------------------------------------------- /regression/disabled/finalize.2.ok.disabled: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 4 4 | 5 5 | 6 6 | 7 7 | 8 8 | 9 9 | 10 10 | 13 11 | -------------------------------------------------------------------------------- /regression/fail/modules.21.sml: -------------------------------------------------------------------------------- 1 | structure S: sig val x: bool end = 2 | struct 3 | val x = 13 4 | end 5 | -------------------------------------------------------------------------------- /regression/fail/modules.34.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type 'a t 4 | end where type 'a t = 'b list 5 | -------------------------------------------------------------------------------- /regression/fail/modules.45.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type 'a t 4 | end where type 'a t = int * 'b 5 | -------------------------------------------------------------------------------- /regression/gc-collect.sml: -------------------------------------------------------------------------------- 1 | val _ = print "Hello, " 2 | val _ = MLton.GC.collect () 3 | val _ = print "world!\n" 4 | -------------------------------------------------------------------------------- /regression/ieee-real.arm-linux.ok: -------------------------------------------------------------------------------- 1 | unhandled exception: SysErr: Invalid argument [inval] 2 | Nonzero exit status. 3 | -------------------------------------------------------------------------------- /regression/listsort.ok: -------------------------------------------------------------------------------- 1 | 2 | File listsort.sml: Testing structure ListSort... 3 | test1 OK 4 | test2 OK 5 | -------------------------------------------------------------------------------- /regression/local-ref.ok: -------------------------------------------------------------------------------- 1 | 0th invocation of fib 2 | 5th invocation of fib 3 | 10th invocation of fib 4 | fib(5) = 8 5 | -------------------------------------------------------------------------------- /regression/posix-exit.sml: -------------------------------------------------------------------------------- 1 | val _ = (TextIO.output (TextIO.stdOut, "hello") 2 | ; Posix.Process.exit 0w0) 3 | -------------------------------------------------------------------------------- /regression/real-str.arm-linux.ok: -------------------------------------------------------------------------------- 1 | unhandled exception: SysErr: Invalid argument [inval] 2 | Nonzero exit status. 3 | -------------------------------------------------------------------------------- /regression/23.sml: -------------------------------------------------------------------------------- 1 | fun f l = 2 | case l of 3 | [] => f l 4 | | _ :: l => f l 5 | 6 | val _ = f [13] 7 | -------------------------------------------------------------------------------- /regression/fail/type.sml: -------------------------------------------------------------------------------- 1 | type t = u 2 | 3 | type 'a t = unit 4 | type u = t 5 | 6 | datatype 'a t = T 7 | type u = t 8 | -------------------------------------------------------------------------------- /regression/int-inf.log2.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 1 4 | 28 5 | 29 6 | 30 7 | 31 8 | 32 9 | 32 10 | 33 11 | 33 12 | OK 13 | -------------------------------------------------------------------------------- /lib/mlton/basic/word32.sml: -------------------------------------------------------------------------------- 1 | structure Word32 = 2 | struct 3 | open Word32 4 | val layout = Layout.str o toString 5 | end 6 | -------------------------------------------------------------------------------- /lib/stubs/common/basis/real32-via-real.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | *) 3 | 4 | structure Real32 = Real 5 | -------------------------------------------------------------------------------- /lib/stubs/common/basis/real64-via-real.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | *) 3 | 4 | structure Real64 = Real 5 | -------------------------------------------------------------------------------- /regression/14.sml: -------------------------------------------------------------------------------- 1 | datatype t = A | B 2 | datatype u = C of t 3 | 4 | val _ = if C A = C B then raise Fail "bug" else () 5 | -------------------------------------------------------------------------------- /regression/dead.sml: -------------------------------------------------------------------------------- 1 | datatype t = A of t 2 | 3 | fun f (A y) = f y 4 | 5 | fun g () = A (g ()) 6 | 7 | val _ = f (g ()) 8 | -------------------------------------------------------------------------------- /regression/fail/modules.10.sml: -------------------------------------------------------------------------------- 1 | type 'a u = int 2 | signature S = 3 | sig 4 | type 'a t 5 | end where type t = u 6 | -------------------------------------------------------------------------------- /regression/fail/modules.13.sml: -------------------------------------------------------------------------------- 1 | type 'a u = unit 2 | signature S = 3 | sig 4 | type 'a t 5 | end where type t = u 6 | -------------------------------------------------------------------------------- /regression/fail/modules.5.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | datatype t = T 4 | end where type t = int * int 5 | ; 6 | -------------------------------------------------------------------------------- /regression/os-exit.sml: -------------------------------------------------------------------------------- 1 | val _ = (TextIO.output (TextIO.stdOut, "hello\n") 2 | ; OS.Process.exit OS.Process.success) 3 | -------------------------------------------------------------------------------- /regression/asterisk.sml: -------------------------------------------------------------------------------- 1 | (* asterisk.sml *) 2 | 3 | (* Checks parsing of "* )". *) 4 | 5 | val op* : int * int -> int = (op*); 6 | -------------------------------------------------------------------------------- /regression/fail/1.sml: -------------------------------------------------------------------------------- 1 | functor F () = 2 | struct 3 | val x = y 4 | end 5 | 6 | val y = 13 7 | 8 | structure S = F () 9 | -------------------------------------------------------------------------------- /regression/fail/escaping-datatype.sml: -------------------------------------------------------------------------------- 1 | val _ = 2 | let 3 | datatype t = T 4 | in 5 | (T, fn T => 1) 6 | end 7 | -------------------------------------------------------------------------------- /regression/fail/modules.14.sml: -------------------------------------------------------------------------------- 1 | type 'a u = unit 2 | signature S = 3 | sig 4 | type 'a t 5 | end where type t = 'b u 6 | -------------------------------------------------------------------------------- /regression/fail/tyvar-scope.1.sml: -------------------------------------------------------------------------------- 1 | fun 'a f (x: 'a) = 2 | let 3 | fun 'a g (y: 'a) = y 4 | in 5 | () 6 | end 7 | -------------------------------------------------------------------------------- /regression/fail/tyvar-scope.2.sml: -------------------------------------------------------------------------------- 1 | fun f (x: 'a) = 2 | let 3 | fun 'a g (y: 'a) = y 4 | in 5 | () 6 | end 7 | -------------------------------------------------------------------------------- /runtime/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore all *.a, *.d, and *.o files 2 | *.a 3 | *.d 4 | *.o 5 | 6 | /gdtoa/ 7 | /c-types.h 8 | /ml-types.h 9 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/exit.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | void Posix_Process_exit (C_Status_t i) { 4 | exit (i); 5 | } 6 | -------------------------------------------------------------------------------- /docs/rts/mm/read-barrier.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Read Barrier 4 | parent: Memory Management 5 | --- 6 | 7 | {: .todo} 8 | ... -------------------------------------------------------------------------------- /regression/6.sml: -------------------------------------------------------------------------------- 1 | fun f x = x 2 | 3 | val r: (int -> int) ref = ref f 4 | 5 | val _ = r := (fn y => y) 6 | 7 | val _ = !r 13 + 1 8 | -------------------------------------------------------------------------------- /regression/callcc.sml: -------------------------------------------------------------------------------- 1 | open MLton.Cont 2 | 3 | val _ = print(Int.toString(1 + callcc(fn k => throw(k, 2)))) 4 | val _ = print "\n" 5 | -------------------------------------------------------------------------------- /regression/fail/datatype-where-complex.1.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | datatype t = T 4 | end where type t = int * int 5 | -------------------------------------------------------------------------------- /regression/fail/modules.7.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type 'a t 4 | type u 5 | sharing type t = u 6 | end 7 | -------------------------------------------------------------------------------- /regression/fail/modules.8.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type t = int 4 | type u 5 | sharing type t = u 6 | end 7 | -------------------------------------------------------------------------------- /regression/fail/sharing.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | structure T: sig type t = int end 4 | sharing T = T 5 | end 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/dup.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Fd_t) Posix_IO_dup (C_Fd_t f) { 4 | return dup (f); 5 | } 6 | -------------------------------------------------------------------------------- /regression/disabled/world4.ok.disabled: -------------------------------------------------------------------------------- 1 | before saves 2 | between saves 3 | after saves 4 | between saves 5 | after saves 6 | after saves 7 | -------------------------------------------------------------------------------- /regression/fail/modules.19.sml: -------------------------------------------------------------------------------- 1 | functor F (type t 2 | type u) = 3 | struct 4 | val id: t -> u = fn x => x 5 | end 6 | -------------------------------------------------------------------------------- /regression/timer.ok: -------------------------------------------------------------------------------- 1 | 2 | File timer.sml: Testing structure Timer... 3 | test1 OK 4 | test2 OK 5 | test3 OK 6 | test4 OK 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/close.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_IO_close (C_Fd_t f) { 4 | return close (f); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/fsync.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_IO_fsync (C_Fd_t f) { 4 | return fsync (f); 5 | } 6 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore all .cm/ directories 2 | .cm/ 3 | 4 | ## Ignore all MLB/ directories 5 | *-mlkit.mlb 6 | *-mlkit-bind*.sml 7 | MLB/ 8 | -------------------------------------------------------------------------------- /regression/cycle.sml: -------------------------------------------------------------------------------- 1 | datatype t = T of u | V 2 | and u = U of t * t 3 | 4 | fun f V = T (U (f V,f V)) 5 | | f (T _) = V 6 | 7 | val _ = f V 8 | -------------------------------------------------------------------------------- /regression/disabled/finalize.5.ok.disabled: -------------------------------------------------------------------------------- 1 | before test 6 2 | before GC 6 3 | after GC 6 4 | before GC 6a 5 | test 6: finalizer 6 | after GC 6a 7 | -------------------------------------------------------------------------------- /regression/fact.sml: -------------------------------------------------------------------------------- 1 | val rec fact = 2 | fn 0 => 1 3 | | n => n * fact(n - 1) 4 | 5 | val _ = print(concat[Int.toString(fact 10), "\n"]) 6 | -------------------------------------------------------------------------------- /regression/fail/modules.1.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype t = T 4 | end = 5 | struct 6 | datatype 'a t = T 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.11.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype t = T 4 | end = 5 | struct 6 | type t = int 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.36.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | include sig type t end where type t = int 4 | end where type t = bool 5 | -------------------------------------------------------------------------------- /regression/fail/modules.9.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type t = int 4 | type u = int 5 | sharing type t = u 6 | end 7 | -------------------------------------------------------------------------------- /regression/lex.sml: -------------------------------------------------------------------------------- 1 | 2 | fun token0(tokFn) = tokFn 3 | 4 | and token1(tokFn, value) = tokFn(value) 5 | 6 | val a = token1(fn _ => "1", 2) 7 | -------------------------------------------------------------------------------- /regression/testdyn2.ok: -------------------------------------------------------------------------------- 1 | Testing [open_out, output, close_out] 2 | Testing [open_in, input, lookahead, end_of_stream, close_in] 3 | End of test. 4 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/umask.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Mode_t Posix_FileSys_umask (C_Mode_t m) { 4 | return umask (m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/isatty.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_ProcEnv_isatty (C_Fd_t f) { 4 | return isatty (f); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/alarm.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_UInt_t Posix_Process_alarm (C_UInt_t i) { 4 | return alarm (i); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/pause.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_Process_pause (void) { 4 | return pause (); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/sleep.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_UInt_t Posix_Process_sleep (C_UInt_t i) { 4 | return sleep (i); 5 | } 6 | -------------------------------------------------------------------------------- /regression/2.sml: -------------------------------------------------------------------------------- 1 | datatype t = A | B 2 | 3 | val f = 4 | fn A => 1 5 | | B => 2 6 | 7 | val _ = f(raise Overflow) 8 | val _ = f(raise Bind) 9 | -------------------------------------------------------------------------------- /regression/3.sml: -------------------------------------------------------------------------------- 1 | (* Lexing tyvars *) 2 | 3 | type ('_a, '1a, ''a, '_, '', ''', ''1) t = int 4 | 5 | type u = (int, int, int, int, int, int, int) t 6 | -------------------------------------------------------------------------------- /regression/abcde.sml: -------------------------------------------------------------------------------- 1 | fun a x = (b x; c x) 2 | and b x = (a x; c x; d x) 3 | and c x = d x 4 | and d x = e x 5 | and e x = d x 6 | 7 | val _ = a 13 8 | -------------------------------------------------------------------------------- /regression/big-array.sml: -------------------------------------------------------------------------------- 1 | open Array 2 | 3 | val a'' = tabulate (1000000, fn i => i) 4 | val _ = sub (a'', 0) + sub (a'', 1) 5 | val _ = print "OK\n" 6 | -------------------------------------------------------------------------------- /regression/fail/modules.22.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | val x: 'a list 4 | end = 5 | struct 6 | val x: unit list = [] 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.37.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | structure S: sig type t end where type t = int 4 | end where type S.t = bool 5 | -------------------------------------------------------------------------------- /regression/fail/modules.41.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | type t 4 | structure S: sig type u = t end where type u = t * t 5 | end 6 | -------------------------------------------------------------------------------- /regression/poly-equal.sml: -------------------------------------------------------------------------------- 1 | val _ = 2 | print(if ([1, 2, 3], [4, 5]) = ([1, 2, 3], [4]) 3 | then "true\n" 4 | else "false\n") 5 | -------------------------------------------------------------------------------- /regression/string2.sml: -------------------------------------------------------------------------------- 1 | val _ = print(concat[Char.toCString #"\000", 2 | String.toCString "\000", 3 | "\n"]) 4 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/fchdir.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_fchdir(C_Fd_t f) { 4 | return fchdir(f); 5 | } 6 | -------------------------------------------------------------------------------- /regression/eq.sml: -------------------------------------------------------------------------------- 1 | fun f x = x + 1 2 | fun g x = x + 2 3 | 4 | val _ = 5 | if MLton.eq (f, g) 6 | then print "yes\n" 7 | else print "no\n" 8 | -------------------------------------------------------------------------------- /regression/fail/modules.24.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype t = A | B 4 | end = 5 | struct 6 | datatype t = B | C 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.4.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type t 4 | type u 5 | type v = t * t 6 | sharing type u = v 7 | end 8 | -------------------------------------------------------------------------------- /regression/vector2.sml: -------------------------------------------------------------------------------- 1 | open Vector 2 | val v = tabulate(13, fn i => fn j => i + j) 3 | val _ = print(Int.toString(sub(v, 5) 1)) 4 | val _ = print "\n" 5 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/dup2.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Fd_t) Posix_IO_dup2 (C_Fd_t f1, C_Fd_t f2) { 4 | return dup2 (f1, f2); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/fcntl2.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_IO_fcntl2 (C_Fd_t f, C_Int_t i) { 4 | return fcntl (f, i); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/pipe.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_IO_pipe (Array(C_Fd_t) fds) { 4 | return pipe ((int *) fds); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/ifExited.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_Process_ifExited (C_Status_t s) { 4 | return WIFEXITED (s); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/ifStopped.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_Process_ifStopped (C_Status_t s) { 4 | return WIFSTOPPED (s); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/termSig.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Signal_t Posix_Process_termSig (C_Status_t s) { 4 | return WTERMSIG (s); 5 | } 6 | -------------------------------------------------------------------------------- /docs/rts/mm/stack.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Call-Stacks 4 | parent: Memory Management 5 | --- 6 | 7 | # Call-Stacks 8 | 9 | {: .todo} 10 | ... -------------------------------------------------------------------------------- /mlton/front-end/.gitignore: -------------------------------------------------------------------------------- 1 | /ml.grm.desc 2 | /ml.grm.sig 3 | /ml.grm.sml 4 | /ml.lex.sml 5 | /mlb.grm.desc 6 | /mlb.grm.sig 7 | /mlb.grm.sml 8 | /mlb.lex.sml 9 | -------------------------------------------------------------------------------- /regression/grow-raise.sml: -------------------------------------------------------------------------------- 1 | exception E 2 | val rec loop = 3 | fn 0 => raise E 4 | | n => 1 + loop(n - 1) 5 | 6 | val _ = loop 1000000 handle E => 13 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/sysconf.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Long_t) Posix_ProcEnv_sysconf (C_Int_t i) { 4 | return sysconf (i); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/ifSignaled.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_Process_ifSignaled (C_Status_t s) { 4 | return WIFSIGNALED (s); 5 | } 6 | -------------------------------------------------------------------------------- /regression/disabled/finalize.3.ok.disabled: -------------------------------------------------------------------------------- 1 | before test 4 2 | before GC 4a 3 | after GC 4a 4 | invoking touch 5 | before GC 4b 6 | test 4: finalizer 7 | after GC 4b 8 | -------------------------------------------------------------------------------- /regression/fail/modules.2.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype 'a t = T of int 4 | end = 5 | struct 6 | datatype 'a t = T of 'a 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.26.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype 'a t = T of int 4 | end = 5 | struct 6 | datatype 'a t = T of 'a 7 | end 8 | -------------------------------------------------------------------------------- /regression/fail/modules.38.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | type t 4 | end where type t = int * int 5 | = 6 | struct 7 | type t = int 8 | end 9 | -------------------------------------------------------------------------------- /regression/fail/tyvar-scope.3.sml: -------------------------------------------------------------------------------- 1 | val _ = 2 | fn () => 3 | let 4 | exception E of 'a 5 | val 'a f = fn z => z 6 | in 7 | () 8 | end 9 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/kill.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_Process_kill (C_PId_t p, C_Signal_t s) { 4 | return kill (p, s); 5 | } 6 | -------------------------------------------------------------------------------- /basis-library/io/bin-stream-io.sig: -------------------------------------------------------------------------------- 1 | signature BIN_STREAM_IO = 2 | STREAM_IO 3 | where type elem = Word8Vector.elem 4 | where type vector = Word8Vector.vector 5 | -------------------------------------------------------------------------------- /basis-library/system/command-line.sig: -------------------------------------------------------------------------------- 1 | signature COMMAND_LINE = 2 | sig 3 | val name: unit -> string 4 | val arguments: unit -> string list 5 | end 6 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.6.sml: -------------------------------------------------------------------------------- 1 | structure S = 2 | struct 3 | val x = 0w0 4 | structure S = struct end 5 | val _ = x: Word8.word 6 | end 7 | -------------------------------------------------------------------------------- /regression/library/.gitignore: -------------------------------------------------------------------------------- 1 | /m?.h 2 | /m?.def 3 | /m?.dll 4 | /libm?.so 5 | /libm?.a 6 | /libm?.dylib 7 | /check.h 8 | /check 9 | /check.exe 10 | /mlmon.out 11 | -------------------------------------------------------------------------------- /regression/string.fromString.ok: -------------------------------------------------------------------------------- 1 | OK SOME [abc] 2 | OK NONE 3 | OK NONE 4 | OK SOME [a] 5 | OK SOME [a] 6 | OK SOME [] 7 | OK SOME [] 8 | OK SOME [] 9 | OK NONE 10 | -------------------------------------------------------------------------------- /regression/vector3.sml: -------------------------------------------------------------------------------- 1 | val v = Vector.tabulate (1000, fn i => ()) 2 | val r = ref 0 3 | val _ = r := Vector.length v 4 | val _ = print (concat [Int.toString (!r), "\n"]) 5 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/chdir.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_chdir(NullString8_t p) { 4 | return chdir((const char *) p); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/fchmod.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_fchmod (C_Fd_t f, C_Mode_t m) { 4 | return fchmod (f, m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/rmdir.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_rmdir (NullString8_t p) { 4 | return rmdir ((const char*) p); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/fcntl3.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_IO_fcntl3 (C_Fd_t f, C_Int_t i, C_Int_t j) { 4 | return fcntl (f, i, j); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/lseek.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Off_t) Posix_IO_lseek (C_Fd_t f, C_Off_t i, C_Int_t j) { 4 | return lseek (f, i, j); 5 | } 6 | -------------------------------------------------------------------------------- /regression/char0.sml: -------------------------------------------------------------------------------- 1 | fun f c = 2 | case c of 3 | #"a" => () 4 | | _ => raise Fail "bug" 5 | 6 | val _ = f #"a" 7 | val _ = f #"a" 8 | 9 | 10 | -------------------------------------------------------------------------------- /regression/date-localOffset.ok: -------------------------------------------------------------------------------- 1 | TZ = UTC+4 :: Date.localOffset () = 14400.000 2 | TZ = UTC+0 :: Date.localOffset () = 0.000 3 | TZ = UTC-4 :: Date.localOffset () = ~14400.000 4 | -------------------------------------------------------------------------------- /regression/int-inf.3.sml: -------------------------------------------------------------------------------- 1 | val _ = print (Bool.toString ((1: IntInf.int) < 2)) 2 | val _ = print (IntInf.toString (IntInf.quot (1234567890, 100000))) 3 | val _ = print "\n" 4 | -------------------------------------------------------------------------------- /regression/real-algsimp.ok: -------------------------------------------------------------------------------- 1 | false 2 | false 3 | false 4 | false 5 | false 6 | true 7 | true 8 | false 9 | false 10 | false 11 | false 12 | false 13 | true 14 | true 15 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/ftruncate.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_ftruncate (C_Fd_t f, C_Off_t n) { 4 | return ftruncate (f, n); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/unlink.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_unlink (NullString8_t p) { 4 | return unlink ((const char*) p); 5 | } 6 | -------------------------------------------------------------------------------- /basis-library/mlton/mono-array.sig: -------------------------------------------------------------------------------- 1 | signature MLTON_MONO_ARRAY = sig 2 | type t 3 | type elem 4 | val fromPoly: elem array -> t 5 | val toPoly: t -> elem array 6 | end 7 | -------------------------------------------------------------------------------- /regression/fail/modules.27.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype t = A | B 4 | end = 5 | struct 6 | datatype t = A | B 7 | datatype u = B 8 | end 9 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.5.sml: -------------------------------------------------------------------------------- 1 | functor F () = 2 | struct 3 | val x = 0w0 4 | structure S = struct end 5 | val _ = x: Word8.word 6 | end 7 | 8 | -------------------------------------------------------------------------------- /regression/real-str.ok: -------------------------------------------------------------------------------- 1 | YES 2 | BFB999999999999A 3 | BFB9999999999999 4 | YES 5 | BFB999999999999A 6 | BFB9999999999999 7 | YES 8 | 3FB999999999999A 9 | 3FB999999999999A 10 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/fchown.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_fchown (C_Fd_t f, C_UId_t u, C_GId_t g) { 4 | return fchown (f, u, g); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/fpathconf.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Long_t) Posix_FileSys_fpathconf (C_Fd_t f, C_Int_t n) { 4 | return fpathconf (f, n); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/system.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Status_t) Posix_Process_system (NullString8_t cmd) { 4 | return system ((const char*) cmd); 5 | } 6 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/basis-equal.sig: -------------------------------------------------------------------------------- 1 | signature BASIS_2002_EQUAL = 2 | sig 3 | val = : ''a * ''a -> bool 4 | val <> : ''a * ''a -> bool 5 | end 6 | -------------------------------------------------------------------------------- /basis-library/mlton/mono-vector.sig: -------------------------------------------------------------------------------- 1 | signature MLTON_MONO_VECTOR = sig 2 | type t 3 | type elem 4 | val fromPoly: elem vector -> t 5 | val toPoly: t -> elem vector 6 | end 7 | -------------------------------------------------------------------------------- /docs/rts/mm/obj-type-table.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Object Type Table 4 | parent: Memory Management 5 | --- 6 | 7 | # The Object Type Table 8 | 9 | {: .todo} 10 | ... -------------------------------------------------------------------------------- /runtime/basis/Net/NetHostDB-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | const C_Size_t NetHostDB_inAddrSize = sizeof (struct in_addr); 4 | const C_Int_t NetHostDB_INADDR_ANY = INADDR_ANY; 5 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/open2.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Fd_t) Posix_FileSys_open2 (NullString8_t p, C_Int_t i) { 4 | return open ((const char*)p, i); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/stopSig.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Signal_t Posix_Process_stopSig (C_Status_t s) { 4 | int i; 5 | 6 | i = s; 7 | return WSTOPSIG (i); 8 | } 9 | -------------------------------------------------------------------------------- /regression/13.sml: -------------------------------------------------------------------------------- 1 | fun plus (a, b) = a 2 | 3 | functor F () = 4 | struct 5 | val _ = plus (plus (1, 2), 3) 6 | end 7 | 8 | infix plus 9 | 10 | structure S = F () 11 | -------------------------------------------------------------------------------- /regression/binio.ok: -------------------------------------------------------------------------------- 1 | basic test of writing and reading back all characters done 2 | test of writing files of all possible characters in strings of lengths 0-256 finished 3 | test finished 4 | -------------------------------------------------------------------------------- /regression/fail/modules.6.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type ('a, 'b) t 4 | type ('a, 'b) u 5 | type ('a, 'b) v = ('b, 'a) t 6 | sharing type u = v 7 | end 8 | -------------------------------------------------------------------------------- /regression/substring-overflow.sml: -------------------------------------------------------------------------------- 1 | open Substring 2 | 3 | val _ = 4 | (slice (full "abc", 1, SOME (valOf Int.maxInt)) 5 | ; print "ERROR\n") 6 | handle Subscript => print "OK\n" 7 | -------------------------------------------------------------------------------- /regression/textio.2.ok: -------------------------------------------------------------------------------- 1 | basic test of writing and reading back all characters done 2 | test of writing files of all possible characters in strings of lengths 0-256 finished 3 | test finished 4 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/access.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_access (NullString8_t f, C_Int_t i) { 4 | return access ((const char *) f, i); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/chmod.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_chmod (NullString8_t p, C_Mode_t m) { 4 | return chmod ((const char *) p, m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/mkdir.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_mkdir (NullString8_t p, C_Mode_t m) { 4 | return mkdir ((const char *) p, m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/mkfifo.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_mkfifo (NullString8_t p, C_Mode_t m) { 4 | return mkfifo ((const char *) p, m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/exitStatus.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_Process_exitStatus (C_Status_t s) { 4 | int i; 5 | 6 | i = s; 7 | return WEXITSTATUS (i); 8 | } 9 | -------------------------------------------------------------------------------- /regression/fail/modules.42.sml: -------------------------------------------------------------------------------- 1 | structure S = struct end 2 | and S = struct end 3 | 4 | functor F () = struct end 5 | and F () = struct end 6 | 7 | signature S = sig end 8 | and S = sig end 9 | -------------------------------------------------------------------------------- /regression/only-one-exception.sml: -------------------------------------------------------------------------------- 1 | fun f n = 2 | if n = 0 3 | then 0 4 | else f (f (n - 1)) 5 | 6 | val _ = f 13 7 | 8 | fun loop () = loop () 9 | 10 | val _ = loop () 11 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/pathconf.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Long_t) Posix_FileSys_pathconf (NullString8_t p, C_Int_t n) { 4 | return pathconf ((const char *)p, n); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/truncate.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_truncate (NullString8_t p, C_Off_t n) { 4 | return truncate ((const char*)p, n); 5 | } 6 | -------------------------------------------------------------------------------- /docs/rts/mm/cgc.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Concurrent Garbage Collection 4 | parent: Memory Management 5 | --- 6 | 7 | # Concurrent Garbage Collection (CGC) 8 | 9 | {: .todo} 10 | ... -------------------------------------------------------------------------------- /regression/exn.sml: -------------------------------------------------------------------------------- 1 | exception E 2 | 3 | fun loop n = 4 | if n = 0 5 | then raise E 6 | else (loop(n - 1) handle e => (print "z"; raise e)) 7 | 8 | val _ = loop 13 handle _ => print "\n" 9 | -------------------------------------------------------------------------------- /regression/fail/modules.3.sml: -------------------------------------------------------------------------------- 1 | functor F (type t 2 | datatype u = U of t 3 | eqtype v 4 | sharing type t = v) = 5 | struct 6 | fun f (u: u) = u = u 7 | end 8 | -------------------------------------------------------------------------------- /regression/kitfib35.sml: -------------------------------------------------------------------------------- 1 | (*kitfib35.sml*) 2 | 3 | val _ = 4 | let 5 | infix + - < 6 | fun fib n = if n < 1 then 1 else fib (n-1) + fib (n-2) 7 | in 8 | fib 35; () 9 | end 10 | 11 | -------------------------------------------------------------------------------- /regression/time3.ok: -------------------------------------------------------------------------------- 1 | 0.000 2 | 123.457 3 | 123 4 | 123.5 5 | 123.46 6 | 123.457 7 | 123.4568 8 | 123.45679 9 | 123.456789 10 | 123.4567890 11 | 123.457 12 | 123.000 13 | 123.456 14 | 123.457 15 | -------------------------------------------------------------------------------- /runtime/basis/Net/Socket/INetSock-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | const C_Int_t Socket_INetSock_Ctl_IPPROTO_TCP = IPPROTO_TCP; 4 | const C_Int_t Socket_INetSock_Ctl_TCP_NODELAY = TCP_NODELAY; 5 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/chown.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_chown (NullString8_t p, C_UId_t u, C_GId_t g) { 4 | return chown ((const char *) p, u, g); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/getenv.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_String_t Posix_ProcEnv_getenv (NullString8_t s) { 4 | char *res = getenv((const char*)s); 5 | return (C_String_t)res; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/setgroups.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_ProcEnv_setgroups (C_Int_t i, Vector(C_GId_t) v) { 4 | return setgroups (i, (const gid_t*)v); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/waitpid.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_PId_t) Posix_Process_waitpid (C_PId_t p, Ref(C_Status_t) s, C_Int_t i) { 4 | return waitpid (p, (int*)s, i); 5 | } 6 | -------------------------------------------------------------------------------- /regression/7.sml: -------------------------------------------------------------------------------- 1 | fun h f = f 13 2 | 3 | fun f x = let fun z x = z(x + 1) 4 | in h z 5 | end 6 | 7 | val r : (int -> int) ref = ref f 8 | 9 | val _ = h(fn x => x) 10 | -------------------------------------------------------------------------------- /regression/disabled/signals.ok.disabled: -------------------------------------------------------------------------------- 1 | sending 1 2 | Got a hup. 3 | You can't int me you loser. 4 | Don't even try to term me. 5 | sending 2 6 | Got a hup. 7 | You can't int me you loser. 8 | sending 3 9 | -------------------------------------------------------------------------------- /regression/disabled/signals3.ok.disabled: -------------------------------------------------------------------------------- 1 | sending 1 2 | Got a hup. 3 | You can't int me you loser. 4 | Don't even try to term me. 5 | sending 2 6 | Got a hup. 7 | You can't int me you loser. 8 | sending 3 9 | -------------------------------------------------------------------------------- /regression/disabled/signals4.ok.disabled: -------------------------------------------------------------------------------- 1 | sending 1 2 | Got a hup. 3 | You can't int me you loser. 4 | Don't even try to term me. 5 | sending 2 6 | Got a hup. 7 | You can't int me you loser. 8 | sending 3 9 | -------------------------------------------------------------------------------- /regression/exponential.sml: -------------------------------------------------------------------------------- 1 | fun f x = x 2 | fun toy () = 3 | let 4 | fun g y = f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f y 5 | in g 3; g 4 6 | end 7 | val _ = toy () 8 | -------------------------------------------------------------------------------- /regression/fail/modules.29.sml: -------------------------------------------------------------------------------- 1 | (* Generativity of functors. *) 2 | functor F () = 3 | struct 4 | datatype t = T 5 | end 6 | structure S1 = F () 7 | structure S2 = F () 8 | val _ = S1.T = S2.T 9 | -------------------------------------------------------------------------------- /regression/fast2.sml: -------------------------------------------------------------------------------- 1 | fun loop (left: Int.int): unit = 2 | if left = 0 3 | then () 4 | else loop (left + ~1) 5 | 6 | val _ = loop 100000000 7 | 8 | val _ = print "All ok\n" 9 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/open3.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Fd_t) Posix_FileSys_open3 (NullString8_t p, C_Int_t i, C_Mode_t m) { 4 | return open ((const char*)p, i, (mode_t)m); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/getlogin.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_String_t) Posix_ProcEnv_getlogin (void) { 4 | char *res = getlogin (); 5 | return (C_Errno_t(C_String_t))res; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/ttyname.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_String_t) Posix_ProcEnv_ttyname (C_Fd_t f) { 4 | char *res = ttyname (f); 5 | return (C_Errno_t(C_String_t))res; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/basis/System/OS/IO/poll-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | const C_Short_t OS_IO_POLLIN = POLLIN; 4 | const C_Short_t OS_IO_POLLPRI = POLLPRI; 5 | const C_Short_t OS_IO_POLLOUT = POLLOUT; 6 | -------------------------------------------------------------------------------- /docs/rts/em/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Entanglement Detection and Management 4 | parent: Runtime System 5 | --- 6 | 7 | # Entanglement Detection and Management 8 | 9 | {: .todo} 10 | ... -------------------------------------------------------------------------------- /regression/array4.sml: -------------------------------------------------------------------------------- 1 | fun f n = 2 | if 0 = Array.sub (Array.tabulate (n, fn i => i), 0) 3 | then () 4 | else f 13 5 | 6 | val _ = (f 0; raise Fail "bug") handle Subscript => () 7 | val _ = f 1 8 | -------------------------------------------------------------------------------- /regression/disabled/README: -------------------------------------------------------------------------------- 1 | These regression tests are not supported in MPL. 2 | 3 | They are named *.disabled so that the scripts for running regression tests 4 | (which look for *.sml) will not find them. 5 | -------------------------------------------------------------------------------- /regression/down.sml: -------------------------------------------------------------------------------- 1 | val rec down = 2 | fn 0 => 0 3 | | n => 1 + down' (n - 1) + down (n - 1) 4 | and down' = 5 | fn 0 => 0 6 | | n => 1 + down (n - 1) + down' (n - 1) 7 | 8 | val _ = down 13 9 | -------------------------------------------------------------------------------- /regression/fail/modules.31.sml: -------------------------------------------------------------------------------- 1 | structure S:> 2 | sig 3 | type t 4 | val x: t 5 | end = 6 | struct 7 | type t = unit 8 | val x = () 9 | end 10 | val _ = S.x = S.x 11 | -------------------------------------------------------------------------------- /regression/fail/modules.32.sml: -------------------------------------------------------------------------------- 1 | structure S:> 2 | sig 3 | type t 4 | val x: t 5 | end = 6 | struct 7 | type t = real 8 | val x = 13.0 9 | end 10 | val _ = S.x = S.x 11 | -------------------------------------------------------------------------------- /regression/mlton.overload.sml: -------------------------------------------------------------------------------- 1 | (* Checks overload declarations. *) 2 | 3 | fun f (x: int) = x 4 | fun g (x: word) = x 5 | 6 | _overload f: 'a -> 'a as f and g 7 | 8 | val _ = f 1 9 | val _ = f 0w1 10 | -------------------------------------------------------------------------------- /regression/semicolon.sml: -------------------------------------------------------------------------------- 1 | (* semicolon.sml *) 2 | 3 | (* Checks parsing of semicolons. *) 4 | 5 | structure A = struct ;;;;;;;; end; 6 | signature S = sig ;;;;;;;;;;; end; 7 | 8 | ;;;;;;;;;;;;;;;; 9 | -------------------------------------------------------------------------------- /regression/slow2.sml: -------------------------------------------------------------------------------- 1 | fun loop (left: IntInf.int): unit = 2 | if left = 0 3 | then () 4 | else loop (left + ~1) 5 | 6 | val _ = loop 100000000 7 | 8 | val _ = print "All ok\n" 9 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/link.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_link (NullString8_t p1, NullString8_t p2) { 4 | return link ((const char *) p1, (const char *) p2); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/IO/lseek-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | const C_Int_t Posix_IO_SEEK_CUR = SEEK_CUR; 4 | const C_Int_t Posix_IO_SEEK_END = SEEK_END; 5 | const C_Int_t Posix_IO_SEEK_SET = SEEK_SET; 6 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/environ.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | /* Manual initialization is a work-around for a Darwin linker issue. */ 4 | C_StringArray_t Posix_ProcEnv_environ = (C_StringArray_t)NULL; 5 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/setenv.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_ProcEnv_setenv (NullString8_t s, NullString8_t v) { 4 | return setenv ((const char*)s, (const char*)v, 1); 5 | } 6 | -------------------------------------------------------------------------------- /lib/mllpt-lib/ml-lpt.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/mllpt-lib.mlb b/lib/mllpt-lib.mlb 2 | new file mode 100644 3 | index 0000000..0d6bf2a 4 | --- /dev/null 5 | +++ b/lib/mllpt-lib.mlb 6 | @@ -0,0 +1 @@ 7 | +ml-lpt-lib.mlb 8 | -------------------------------------------------------------------------------- /regression/fail/modules.28.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | datatype t = A | B of unit 4 | end = 5 | struct 6 | datatype t = A | B of int 7 | 8 | val rec B = fn () => A 9 | end 10 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/getcwd.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_String_t Posix_FileSys_getcwd (Array(Char8_t) buf, C_Size_t n) { 4 | char *res = getcwd ((char*)buf, n); 5 | return (C_String_t)res; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/symlink.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_Int_t) Posix_FileSys_symlink (NullString8_t p1, NullString8_t p2) { 4 | return symlink ((const char*) p1, (const char*) p2); 5 | } 6 | -------------------------------------------------------------------------------- /runtime/gen/.gitignore: -------------------------------------------------------------------------------- 1 | /c-types.h 2 | /c-types.sml 3 | /constants 4 | /gen-basis-ffi 5 | /gen-basis-ffi.exe 6 | /gen-constants 7 | /gen-constants.exe 8 | /gen-types 9 | /gen-types.exe 10 | /ml-types.h 11 | -------------------------------------------------------------------------------- /mlton/atoms/spid.sig: -------------------------------------------------------------------------------- 1 | (* signature SPID = ID *) 2 | signature SPID = 3 | sig 4 | include ID 5 | val getTokenSplitPolicy: t -> Word32.word 6 | val setTokenSplitPolicy: t * Word32.word -> unit 7 | end 8 | -------------------------------------------------------------------------------- /mltrace/NOTES.md: -------------------------------------------------------------------------------- 1 | This creates a .json trace file, compatible with Perfetto: https://www.ui.perfetto.dev/ 2 | 3 | $ mpl -trace true -trace-runtime true foo.sml 4 | $ mltrace record ./foo 5 | $ mltrace exportj 6 | -------------------------------------------------------------------------------- /regression/fail/modules.23.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | val f: 'a -> 'a list 4 | end = 5 | struct 6 | fun f x = 7 | if x = x 8 | then [] 9 | else [x] 10 | end 11 | -------------------------------------------------------------------------------- /regression/pack-word.ok: -------------------------------------------------------------------------------- 1 | 3020100 2 | 7060504 3 | OK 4 | OK 5 | OK 6 | 10203 7 | 4050607 8 | OK 9 | OK 10 | OK 11 | FFFEFDFC 12 | 7060504 13 | OK 14 | OK 15 | OK 16 | FFFEFDFC 17 | 4050607 18 | OK 19 | OK 20 | OK 21 | -------------------------------------------------------------------------------- /runtime/basis/Posix/FileSys/readlink.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Errno_t(C_SSize_t) Posix_FileSys_readlink (NullString8_t p, Array(Char8_t) b, C_Size_t n) { 4 | return readlink ((const char*)p, (char*)b, n); 5 | } 6 | -------------------------------------------------------------------------------- /regression/fail/modules.33.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | type t = int 4 | end 5 | signature S = 6 | sig 7 | structure S1: S 8 | structure S2: S 9 | sharing type S1.t = S2.t 10 | end 11 | -------------------------------------------------------------------------------- /regression/thread1.ok: -------------------------------------------------------------------------------- 1 | 10 2 | 8 3 | 6 4 | 4 5 | 2 6 | 9 7 | 7 8 | 5 9 | 3 10 | 1 11 | 8 12 | 6 13 | 4 14 | 2 15 | 7 16 | 5 17 | 3 18 | 1 19 | 6 20 | 4 21 | 2 22 | 5 23 | 3 24 | 1 25 | 4 26 | 2 27 | 3 28 | 1 29 | 2 30 | 1 31 | -------------------------------------------------------------------------------- /regression/withtype.sml: -------------------------------------------------------------------------------- 1 | (* withtype.sml *) 2 | 3 | (* Checks scoping rules of withtype *) 4 | 5 | type u = int 6 | 7 | datatype t = T of u * v 8 | withtype u = bool 9 | and v = u 10 | 11 | val x = T(true, 6); 12 | -------------------------------------------------------------------------------- /runtime/basis/MLton/Itimer/itimer-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | const C_Int_t MLton_Itimer_PROF = ITIMER_PROF; 4 | const C_Int_t MLton_Itimer_REAL = ITIMER_REAL; 5 | const C_Int_t MLton_Itimer_VIRTUAL = ITIMER_VIRTUAL; 6 | -------------------------------------------------------------------------------- /basis-library/mlton/platform-pre.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure PreMLton = Primitive.MLton 8 | -------------------------------------------------------------------------------- /regression/disabled/test-spawn.ok.disabled: -------------------------------------------------------------------------------- 1 | spawn test: 2 | testing stdout... 3 | Hello world! [stdout] 4 | exit_status: W_EXITED 5 | testing exit... 6 | exit_status: W_EXITSTATUS 7 7 | testing diverge... 8 | exit_status: W_SIGNALED 9 9 | -------------------------------------------------------------------------------- /regression/fail/modules.39.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | type u 4 | type v = u 5 | end where type v = int 6 | structure S: SIG = 7 | struct 8 | type u = real 9 | type v = real 10 | end 11 | -------------------------------------------------------------------------------- /regression/fail/modules.48.sml: -------------------------------------------------------------------------------- 1 | signature S = 2 | sig 3 | datatype t = T 4 | end 5 | 6 | structure S1: S = 7 | struct 8 | datatype t = T 9 | end 10 | 11 | structure S2: S where type t = int = S1 12 | -------------------------------------------------------------------------------- /regression/nonterminate/8.sml: -------------------------------------------------------------------------------- 1 | datatype t = T of t 2 | 3 | datatype u = A of int | B of t * int 4 | 5 | fun f () = T (f ()) 6 | 7 | val _ = 8 | case if 0 = 0 then B (f (), 13) else A 13 of 9 | B (_, n) => n + 1 10 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/io/bin-stream-io.sig: -------------------------------------------------------------------------------- 1 | signature BIN_STREAM_IO_1997 = 2 | sig 3 | include STREAM_IO_1997 4 | where type vector = Word8Vector.vector 5 | where type elem = Word8Vector.elem 6 | end 7 | -------------------------------------------------------------------------------- /regression/disabled/finalize.4.ok.disabled: -------------------------------------------------------------------------------- 1 | before test 5 2 | before GC 5 3 | after GC 5 4 | before GC 5a 5 | after GC 5a 6 | invoking touch 7 | before GC 5b 8 | test 5: finalizer 9 | after GC 5b 10 | before GC 5c 11 | after GC 5c 12 | -------------------------------------------------------------------------------- /regression/disabled/test-create.ok.disabled: -------------------------------------------------------------------------------- 1 | create test: 2 | testing stdout... 3 | Hello world! [stdout] 4 | exit_status: W_EXITED 5 | testing exit... 6 | exit_status: W_EXITSTATUS 7 7 | testing diverge... 8 | exit_status: W_SIGNALED 9 9 | -------------------------------------------------------------------------------- /regression/fail/duplicate-tyvar.sml: -------------------------------------------------------------------------------- 1 | type ('a, 'a) t = unit 2 | 3 | datatype ('a, 'a) t = T of ('a, 'a) u 4 | withtype ('b, 'b) u = 'b * 'b 5 | 6 | fun ('a, 'a) id (x: 'a) : 'a = x 7 | val ('a, 'a) id : 'a -> 'a = fn (x: 'a) => x : 'a 8 | -------------------------------------------------------------------------------- /regression/fail/modules.40.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | type t 4 | structure S: 5 | sig 6 | type u = t 7 | type v 8 | sharing type u = v 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /regression/tak.sml: -------------------------------------------------------------------------------- 1 | fun tak(x,y,z) = 2 | if y >= x 3 | then z 4 | else tak(tak(x - 1, y, z), 5 | tak(y - 1, z, x), 6 | tak(z - 1, x, y)) 7 | 8 | val _ = print(concat[Int.toString(tak(18,12,6)), "\n"]) 9 | -------------------------------------------------------------------------------- /runtime/gc/model.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2005-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | */ 7 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Process/waitpid-consts.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | // const C_Int_t Posix_Process_W_CONTINUED = WCONTINUED; 4 | const C_Int_t Posix_Process_W_NOHANG = WNOHANG; 5 | const C_Int_t Posix_Process_W_UNTRACED = WUNTRACED; 6 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/README: -------------------------------------------------------------------------------- 1 | The files in this directory define the MLton structure within the 2 | context of the Standard ML Basis Library. Many things are defined to 3 | raise exceptions, but enough is emulated so that we can compile MLton 4 | itself. 5 | -------------------------------------------------------------------------------- /regression/exn2.sml: -------------------------------------------------------------------------------- 1 | fun die(): 'a = 2 | let exception Die 3 | in raise Die 4 | end 5 | 6 | val _ = 7 | let val _: string = die() 8 | val _: real = die() 9 | val _: bool = die() 10 | in () 11 | end handle _ => () 12 | -------------------------------------------------------------------------------- /regression/fail/functor-generative-equality.sml: -------------------------------------------------------------------------------- 1 | functor F () = 2 | struct 3 | datatype t = T of int -> int 4 | end 5 | 6 | functor G () = 7 | struct 8 | structure S = F () 9 | 10 | fun f (x: S.t) = x = x 11 | end 12 | -------------------------------------------------------------------------------- /regression/lambda-list-ref.sml: -------------------------------------------------------------------------------- 1 | val r : (int -> int) list ref = ref [] 2 | 3 | val _ = r := (fn x => x + 1) :: ! r 4 | val _ = r := (fn x => x + 2) :: ! r 5 | 6 | val _ = app (fn f => (f 13; ())) (!r) 7 | 8 | 9 | -------------------------------------------------------------------------------- /mlton/mlton-smlnj.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | Library 8 | 9 | structure Main 10 | 11 | is 12 | 13 | sources.cm 14 | -------------------------------------------------------------------------------- /regression/fail/sig.2.sml: -------------------------------------------------------------------------------- 1 | signature S = sig type t end 2 | signature S1 = S where type t = int 3 | signature S2 = S where type t = real 4 | 5 | structure S1: S1 = 6 | struct 7 | type t = int 8 | end 9 | 10 | structure S2: S2 = S1 11 | 12 | -------------------------------------------------------------------------------- /regression/fast.sml: -------------------------------------------------------------------------------- 1 | fun loop (left: Int.int): unit = 2 | case Int.compare (left, 0) of 3 | LESS => () 4 | | EQUAL => () 5 | | GREATER => loop (left + ~1) 6 | 7 | val _ = loop 100000000 8 | 9 | val _ = print "All ok\n" 10 | -------------------------------------------------------------------------------- /regression/stringcvt.ok: -------------------------------------------------------------------------------- 1 | 2 | File stringcvt.sml: Testing structure StringCvt... 3 | test1 OK 4 | test2 OK 5 | test3 OK 6 | test4 OK 7 | test5 OK 8 | test6 OK 9 | test7 OK 10 | test8 OK 11 | test9 OK 12 | test10 OK 13 | -------------------------------------------------------------------------------- /basis-library/basis.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | basis-2002.mlb 9 | -------------------------------------------------------------------------------- /docs/rts/mm/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Memory Management 4 | parent: Runtime System 5 | --- 6 | 7 | # Memory Management 8 | 9 | {: .todo} 10 | ... 11 | 12 | Main source location: [`runtime/gc/`](https://github.com/MPLLang/mpl/tree/main/runtime/gc) -------------------------------------------------------------------------------- /mlton/atoms/func.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature FUNC = ID 9 | -------------------------------------------------------------------------------- /regression/.gitignore: -------------------------------------------------------------------------------- 1 | /RepeatParserCombinator.txt 2 | /empty.dat 3 | /hardlinkA 4 | /hardlinkB 5 | /medium.dat 6 | /outFuhMishra[012345] 7 | /small1.dat 8 | /small2.dat 9 | /test.dat 10 | /testbadl 11 | /testcycl 12 | /testlink 13 | /text.dat 14 | /textio.tmp 15 | -------------------------------------------------------------------------------- /regression/array5.ok: -------------------------------------------------------------------------------- 1 | 13 13 13 13 13 2 | 13 13 13 13 13 3 | 13 13 13 13 13 4 | 13 13 13 13 13 5 | 0 1 2 3 4 6 | 1 2 3 4 5 7 | 2 3 4 5 6 8 | 3 4 5 6 7 9 | 1 2 10 | 3 4 11 | 5 6 12 | 1 2 3 13 | 4 5 6 14 | 7 8 9 15 | 1 4 7 16 | 2 5 8 17 | 3 6 9 18 | -------------------------------------------------------------------------------- /regression/command-line.sml: -------------------------------------------------------------------------------- 1 | (* print out the command name and all of the command line arguments on separate 2 | lines *) 3 | 4 | val _ = 5 | (print(CommandLine.name()) ; 6 | print "\n" ; 7 | app (fn s => (print s ; print "\n")) (CommandLine.arguments())) 8 | -------------------------------------------------------------------------------- /regression/fail/modules.18.sml: -------------------------------------------------------------------------------- 1 | structure T = 2 | struct 3 | structure X = 4 | struct 5 | type t = int 6 | end 7 | end 8 | signature S = 9 | sig 10 | structure T: sig end 11 | val x: T.X.t 12 | end 13 | -------------------------------------------------------------------------------- /regression/layout.sml: -------------------------------------------------------------------------------- 1 | 2 | fun layout (cbs : (string * real) list list) : string = 3 | let 4 | val layoutcb = 5 | map (fn (con,_) => con) 6 | 7 | fun layoutdb cb = "{" ^ concat(layoutcb cb) ^ "}" 8 | in concat(map layoutdb cbs) 9 | end 10 | -------------------------------------------------------------------------------- /regression/once.ok: -------------------------------------------------------------------------------- 1 | a = 12 b = 12 2 | a = 11 b = 12 3 | a = 10 b = 12 4 | a = 9 b = 12 5 | a = 8 b = 12 6 | a = 7 b = 12 7 | a = 6 b = 12 8 | a = 5 b = 12 9 | a = 4 b = 12 10 | a = 3 b = 12 11 | a = 2 b = 12 12 | a = 1 b = 12 13 | a = 0 b = 12 14 | -------------------------------------------------------------------------------- /regression/open.sml: -------------------------------------------------------------------------------- 1 | (* open.sml *) 2 | 3 | (* Checks scoping rules of open. *) 4 | 5 | structure A = struct structure B = struct val x = 1 end end 6 | structure B = struct val x = 0.1 end 7 | 8 | open A B 9 | 10 | val y = B.x + 1 11 | val z = x + 1.0; 12 | -------------------------------------------------------------------------------- /regression/slow.sml: -------------------------------------------------------------------------------- 1 | fun loop (left: IntInf.int): unit = 2 | case IntInf.compare (left, 0) of 3 | LESS => () 4 | | EQUAL => () 5 | | GREATER => loop (left + ~1) 6 | 7 | val _ = loop 100000000 8 | 9 | val _ = print "All ok\n" 10 | -------------------------------------------------------------------------------- /regression/useless-string.sml: -------------------------------------------------------------------------------- 1 | val x = "abc" 2 | val y = "defg" 3 | val _ = 4 | if 3 = (String.size 5 | (if 0 = length (CommandLine.arguments ()) 6 | then x 7 | else y)) 8 | then () 9 | else raise Fail "bug" 10 | -------------------------------------------------------------------------------- /regression/withtype4.sml: -------------------------------------------------------------------------------- 1 | (* withtype4.sml *) 2 | 3 | (* Checks scoping rules of withtype *) 4 | 5 | type u = real 6 | 7 | datatype t = T of u * v 8 | withtype u = int 9 | and v = u 10 | 11 | val x = T(1, 1.0); 12 | 13 | fun uEq (a: u, b: u) = a = b 14 | -------------------------------------------------------------------------------- /mlton/atoms/label.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature LABEL = ID 9 | -------------------------------------------------------------------------------- /regression/exn-history.sml: -------------------------------------------------------------------------------- 1 | fun f x = 2 | if x = 0 3 | then raise Fail "ok" 4 | else f (x - 1) handle Overflow => 13 5 | 6 | val _ = (f 10; ()) handle e => (List.app (fn s => print (concat [s, "\n"])) 7 | (SMLofNJ.exnHistory e)) 8 | -------------------------------------------------------------------------------- /regression/fail/sharing.2.sml: -------------------------------------------------------------------------------- 1 | functor F (structure A: sig type t end 2 | structure B: sig end 3 | structure C: sig type t end 4 | sharing A = B 5 | sharing B = C) = 6 | struct 7 | val _: A.t -> C.t = fn x => x 8 | end 9 | -------------------------------------------------------------------------------- /runtime/platform/netbsd.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | #include "platform/diskBack.unix.c" 4 | #include "platform/displayMem.proc.c" 5 | #include "platform/mmap-protect.c" 6 | #include "platform/nonwin.c" 7 | #include "platform/sysctl.c" 8 | #include "platform/use-mmap.c" 9 | -------------------------------------------------------------------------------- /regression/fail/modules.15.sml: -------------------------------------------------------------------------------- 1 | (* u admits equality, but t does not, hence cannot substitute t for u. *) 2 | signature S = 3 | sig 4 | type t 5 | structure Z: 6 | sig 7 | datatype u = U 8 | end where type u = t 9 | end 10 | -------------------------------------------------------------------------------- /regression/slower.sml: -------------------------------------------------------------------------------- 1 | fun loop (left: IntInf.int): unit = 2 | case IntInf.compare (left, 4294967296) of 3 | LESS => () 4 | | EQUAL => () 5 | | GREATER => loop (left + ~1) 6 | 7 | val _ = loop 4304967296 8 | 9 | val _ = print "All ok\n" 10 | -------------------------------------------------------------------------------- /regression/bool-triple.sml: -------------------------------------------------------------------------------- 1 | val a = Array.array (100, (true, false, true)) 2 | val _ = Array.update (a, 0, (false, true, false)) 3 | val b = 4 | Array.sub (a, 0) = Array.sub (a, 1) 5 | andalso Array.sub (a, 2) = Array.sub (a, 3) 6 | val _ = print (concat [Bool.toString b, "\n"]) 7 | -------------------------------------------------------------------------------- /regression/known-case0.sml: -------------------------------------------------------------------------------- 1 | 2 | fun nlist 0 = 0::nil 3 | | nlist n = n::(nlist (n-1)) 4 | 5 | val rec last = 6 | fn nil => 0 7 | | x::nil => x 8 | | _ :: l => last l 9 | 10 | val n = 1 + (last (nlist (10))) 11 | 12 | val _ = print ((Int.toString n) ^ "\n") 13 | -------------------------------------------------------------------------------- /regression/scon.sml: -------------------------------------------------------------------------------- 1 | (* scon *) 2 | 3 | (* Checks parsing of special constants. *) 4 | 5 | #"\^C"; 6 | #"\a"; 7 | #"\u0000"; 8 | #"\ \x\ \"; 9 | 3.2121212121212121212121212121; 10 | 2e3; 11 | 0.00000000000e123213213123213123123; 12 | 0wxabcd; 13 | 0xAaAa; 14 | -------------------------------------------------------------------------------- /basis-library/mpl/mpl.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2020 Sam Westrick. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | signature MPL = 8 | sig 9 | structure File: MPL_FILE 10 | structure GC: MPL_GC 11 | end 12 | -------------------------------------------------------------------------------- /lib/mlton/basic/itimer.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Itimer = MLton.Itimer 9 | -------------------------------------------------------------------------------- /regression/4.sml: -------------------------------------------------------------------------------- 1 | (* This code has a handler which is provably unreachable. *) 2 | 3 | fun f(n: int): int list = 4 | if n = 0 5 | then [] 6 | else 7 | let val x = f(n - 1) 8 | in [13] handle e => (hd x + 1; raise e) 9 | end 10 | 11 | val _ = f 13 12 | -------------------------------------------------------------------------------- /lib/mlton/basic/unit.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature UNIT = T where type t = unit 9 | -------------------------------------------------------------------------------- /mltrace/Makefile: -------------------------------------------------------------------------------- 1 | INCLUDE:=../runtime 2 | CFLAGS=-Wall -I$(INCLUDE) -O2 -g 3 | OBJS:=tracetr.o 4 | 5 | .PHONY: all clean 6 | 7 | all: tracetr 8 | 9 | clean: 10 | rm -f $(OBJS) 11 | 12 | %.o: %.c 13 | $(CC) $(CFLAGS) -c $^ -o $@ 14 | 15 | tracetr: $(OBJS) 16 | $(CC) $^ -o $@ 17 | -------------------------------------------------------------------------------- /regression/fail/modules.25.sml: -------------------------------------------------------------------------------- 1 | structure S: 2 | sig 3 | structure T: 4 | sig 5 | datatype t = A | B 6 | end 7 | end = 8 | struct 9 | structure T = 10 | struct 11 | datatype t = B | C 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /runtime/basis/System/CommandLine.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | /* Manual initialization is a work-around for a Darwin linker issue. */ 4 | C_Int_t CommandLine_argc = 0; 5 | C_StringArray_t CommandLine_argv = (C_StringArray_t)NULL; 6 | C_String_t CommandLine_commandName = (C_String_t)NULL; 7 | -------------------------------------------------------------------------------- /basis-library/config/bind/int-inf-top.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure IntInf = IntInf 9 | -------------------------------------------------------------------------------- /basis-library/mlton/bin-io.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2005, 2008 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature MLTON_BIN_IO = MLTON_IO 9 | -------------------------------------------------------------------------------- /basis-library/mpl/mpl.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2020 Sam Westrick. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure MPL :> MPL = 8 | struct 9 | structure File = MPLFile 10 | structure GC = MPLGC 11 | end 12 | -------------------------------------------------------------------------------- /runtime/basis/Posix/ProcEnv/getgroups.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Posix_ProcEnv_getgroupsN (void) { 4 | return getgroups (0, (gid_t*)NULL); 5 | } 6 | 7 | C_Errno_t(C_Int_t) Posix_ProcEnv_getgroups (C_Int_t i, Array(C_GId_t) a) { 8 | return getgroups (i, (gid_t*)a); 9 | } 10 | -------------------------------------------------------------------------------- /lib/stubs/mlkit/basis/pervasive.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a BSD-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | local 8 | $(SML_LIB)/basis/basis.mlb 9 | in 10 | ../../common/basis/pervasive.sml 11 | end 12 | -------------------------------------------------------------------------------- /regression/fixed-integer.ok: -------------------------------------------------------------------------------- 1 | Testing Int2 2 | Testing Int3 3 | Testing Int4 4 | Testing Int7 5 | Testing Int8 6 | Testing Int9 7 | Testing Int13 8 | Testing Int16 9 | Testing Int17 10 | Testing Int20 11 | Testing Int25 12 | Testing Int30 13 | Testing Int31 14 | Testing Int32 15 | Testing Int64 16 | -------------------------------------------------------------------------------- /regression/pat.sml: -------------------------------------------------------------------------------- 1 | val c: int as d: int = 13 2 | val c: unit -> unit as d: unit -> unit = fn () => () 3 | val c: 'a -> unit as d: 'a -> unit = fn _ => () 4 | 5 | val (f, hd::tail) = (fn x => x, [fn y => (y,y)]) 6 | 7 | val (s,_) = f (hd "hello world\n") 8 | 9 | val _ = print (s) 10 | 11 | 12 | -------------------------------------------------------------------------------- /runtime/platform/amd64.h: -------------------------------------------------------------------------------- 1 | #define MLton_Platform_Arch_host "amd64" 2 | 3 | #define POINTER_BITS 64 4 | #if (defined (__CYGWIN__) || defined (__MINGW32__)) 5 | #define ADDRESS_BITS 43 6 | #elif (defined (__linux__)) 7 | #define ADDRESS_BITS 48 8 | #else 9 | #define ADDRESS_BITS 40 10 | #endif 11 | -------------------------------------------------------------------------------- /basis-library/config/bind/int-inf-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure IntInf = Primitive.IntInf 9 | -------------------------------------------------------------------------------- /basis-library/config/bind/pointer-mlton.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Pointer = MLton.Pointer 9 | -------------------------------------------------------------------------------- /basis-library/config/bind/pointer-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Pointer = Primitive.Pointer 9 | -------------------------------------------------------------------------------- /regression/array3.sml: -------------------------------------------------------------------------------- 1 | open Array 2 | 3 | val a = array (1000, 0) 4 | 5 | fun g i = (update (a, i, i); g (i + 1)) 6 | 7 | fun f i = 8 | if i = 100 9 | then g i 10 | else (update (a, i, 0); f (i + 1)) 11 | 12 | val _ = f 0 handle Subscript => () 13 | 14 | val _ = sub (a, 0) + 1 15 | -------------------------------------------------------------------------------- /regression/known-case1.sml: -------------------------------------------------------------------------------- 1 | 2 | fun nlist 0 = 0::nil 3 | | nlist n = n::(nlist (n-1)) 4 | 5 | val rec last = 6 | fn nil => 0 7 | | x::nil => x 8 | | y::x::nil => y 9 | | _ :: l => last l 10 | 11 | val n = 1 + (last (nlist (10))) 12 | 13 | val _ = print ((Int.toString n) ^ "\n") 14 | -------------------------------------------------------------------------------- /regression/withtype3.sml: -------------------------------------------------------------------------------- 1 | (* withtype3.sml *) 2 | 3 | (* Checks scoping rules of withtype *) 4 | 5 | type u = real 6 | 7 | datatype t = T of u * v 8 | withtype u = int 9 | and v = u 10 | 11 | val z = T (1, 1.0) 12 | 13 | val x : v = 1.0 14 | val y : u = 1 15 | 16 | fun uEq (a: u, b: u) = a = b 17 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/top-level/top-level.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | 9 | open Basis1997 10 | -------------------------------------------------------------------------------- /lib/mlton/basic/ps.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Ps: PS = 9 | struct 10 | 11 | 12 | end 13 | -------------------------------------------------------------------------------- /mlton/backend/rssa.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2019 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | functor Rssa (S: RSSA_STRUCTS): RSSA = 8 | RssaSimplify (RssaRestore (RssaLive (RssaShrink (RssaTypeCheck (RssaTree (S)))))) 9 | -------------------------------------------------------------------------------- /runtime/gc/gdtoa-multiple-threads-defs.h: -------------------------------------------------------------------------------- 1 | #ifndef GDTOA_MULTIPLE_THREADS_DEFS_ 2 | #define GDTOA_MULTIPLE_THREADS_DEFS_ 3 | 4 | extern void set_max_gdtoa_threads(unsigned int n); 5 | void ACQUIRE_DTOA_LOCK(int n); 6 | void FREE_DTOA_LOCK(int n); 7 | unsigned int dtoa_get_threadno(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /basis-library/libs/basis-none/top-level/top-level.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2005, 2008 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | 9 | open BasisNone 10 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/pre-sources.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | Library 8 | 9 | structure PreMLton 10 | 11 | is 12 | 13 | ../smlnj/mlton/sources.cm 14 | 15 | pre-mlton.sml 16 | -------------------------------------------------------------------------------- /mlton/backend/rssa.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2019 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | signature RSSA_STRUCTS = RSSA_TREE_STRUCTS 8 | 9 | signature RSSA = 10 | sig 11 | include RSSA_SIMPLIFY 12 | end 13 | -------------------------------------------------------------------------------- /mlton/mlton.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | sources.mlb 10 | in 11 | call-main.sml 12 | end 13 | -------------------------------------------------------------------------------- /regression/deep-flatten.sml: -------------------------------------------------------------------------------- 1 | fun f r = 2 | case #1 (!r) of 3 | 3 => r := (5, 6) 4 | | _ => f (ref (7, 8)) 5 | 6 | val r = ref (1, 2) 7 | val _ = r := (3, 4) 8 | val _ = f r 9 | val _ = print (concat [Int.toString (#1 (!r)), " ", 10 | Int.toString (#2 (!r)), "\n"]) 11 | -------------------------------------------------------------------------------- /regression/disabled/mutex.ok.disabled: -------------------------------------------------------------------------------- 1 | exiting 2 | starting 3 | starting 4 | starting 5 | starting 6 | starting 7 | starting 8 | starting 9 | starting 10 | starting 11 | starting 12 | exiting 13 | exiting 14 | exiting 15 | exiting 16 | exiting 17 | exiting 18 | exiting 19 | exiting 20 | exiting 21 | exiting 22 | -------------------------------------------------------------------------------- /regression/fail/modules.50.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | type t 4 | end 5 | 6 | structure S: 7 | sig 8 | structure S1: SIG 9 | end where type S1.t = int = 10 | struct 11 | structure S1: SIG = 12 | struct 13 | type t = real 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /regression/int-inf.rep1.sml: -------------------------------------------------------------------------------- 1 | structure I = MLton.IntInf 2 | val bigthree = Vector.fromList (List.map I.BigWord.fromInt [0,3]) 3 | val three = case I.fromRep (I.Big bigthree) of SOME b3 => b3 | NONE => 3 4 | val () = if three = three + 1 - 1 5 | then print "That's good\n" 6 | else print "That's bad\n" 7 | -------------------------------------------------------------------------------- /regression/vector-loop.sml: -------------------------------------------------------------------------------- 1 | open Vector 2 | 3 | datatype t = T of t vector 4 | fun makeT() = T(tabulate(0, fn _ => makeT())) 5 | fun destT(T v) = 6 | if length v > 0 7 | then 1 + destT(sub(v, 0)) 8 | else 0 9 | val _ = 10 | if 0 = destT(makeT()) 11 | then () 12 | else raise Fail "bug" 13 | -------------------------------------------------------------------------------- /runtime/platform/displayMem.proc.c: -------------------------------------------------------------------------------- 1 | void GC_displayMem (void) { 2 | static char buffer[256]; 3 | int res; 4 | 5 | snprintf (buffer, cardof(buffer), "/bin/cat /proc/%d/maps\n", (int)(getpid ())); 6 | res = system (buffer); 7 | if (-1 == res) 8 | return; 9 | } 10 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/basis.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Basis2002 : BASIS_2002 = BasisExtra 9 | -------------------------------------------------------------------------------- /basis-library/libs/basis-none/top-level/basis.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure BasisNone : BASIS_NONE = BasisExtra 9 | -------------------------------------------------------------------------------- /basis-library/net/net-prot-db.sig: -------------------------------------------------------------------------------- 1 | signature NET_PROT_DB = 2 | sig 3 | type entry 4 | val name: entry -> string 5 | val aliases: entry -> string list 6 | val protocol: entry -> int 7 | val getByName: string -> entry option 8 | val getByNumber: int -> entry option 9 | end 10 | -------------------------------------------------------------------------------- /regression/listpair.ok: -------------------------------------------------------------------------------- 1 | 2 | File listpair.sml: Testing structure ListPair... 3 | test1 OK 4 | test2a OK 5 | test2b OK 6 | test3a OK 7 | checkv OK 8 | checkv OK 9 | test5a OK 10 | test5b OK 11 | test5c OK 12 | checkv OK 13 | checkv OK 14 | test6 OK 15 | test7 OK 16 | -------------------------------------------------------------------------------- /basis-library/config/metadata/normal-metadata-size128.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2016-2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure NormalMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 16 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/normal-metadata-size32.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2016-2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure NormalMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 4 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/normal-metadata-size64.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2016-2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure NormalMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 8 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/sequence-metadata-size128.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure SequenceMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 16 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/sequence-metadata-size192.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure SequenceMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 24 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/sequence-metadata-size256.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure SequenceMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 32 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/config/metadata/sequence-metadata-size96.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2017 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure SequenceMetaDataSize = 8 | struct 9 | val bytes : Int32.int = 12 10 | end 11 | -------------------------------------------------------------------------------- /regression/circular.sml: -------------------------------------------------------------------------------- 1 | open Vector 2 | 3 | datatype t = T of t vector 4 | fun makeT () = T (tabulate (0, fn _ => makeT ())) 5 | fun destT (T v) = 6 | if length v > 0 7 | then 1 + destT (sub (v, 0)) 8 | else 0 9 | val _ = 10 | if 0 = destT (makeT ()) 11 | then () 12 | else raise Fail "bug" 13 | -------------------------------------------------------------------------------- /regression/nested-loop.sml: -------------------------------------------------------------------------------- 1 | fun loop1 x = 2 | if x = 0 3 | then () 4 | else (let 5 | fun loop2 y = 6 | if y = 0 7 | then () 8 | else loop2 (y - 1) 9 | in loop2 x 10 | end; 11 | loop1 (x - 1)) 12 | 13 | val _ = loop1 13 14 | -------------------------------------------------------------------------------- /regression/withtype2.sml: -------------------------------------------------------------------------------- 1 | (* withtype2.sml *) 2 | 3 | (* Checks scoping rules of withtype *) 4 | 5 | type u = real 6 | 7 | datatype t = A of v | B of u 8 | withtype u = int 9 | and v = u 10 | 11 | val a = A 1.0 12 | val b = B 1 13 | 14 | val x : v = 1.0 15 | val y : u = 1 16 | 17 | fun uEq (a: u, b: u) = a = b 18 | -------------------------------------------------------------------------------- /runtime/basis/Posix/Error.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | void Posix_Error_clearErrno (void) { 4 | errno = 0; 5 | } 6 | 7 | C_Int_t Posix_Error_getErrno (void) { 8 | return errno; 9 | } 10 | 11 | C_String_t Posix_Error_strError (C_Int_t n) { 12 | char *res = strerror (n); 13 | return (C_String_t)res; 14 | } 15 | -------------------------------------------------------------------------------- /basis-library/config/bind/real-top.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Real32 = Real32 9 | structure Real64 = Real64 10 | -------------------------------------------------------------------------------- /lib/stubs/mlkit/basis/unsafe.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a BSD-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | local 8 | $(SML_LIB)/basis/basis.mlb 9 | in 10 | ../../common/basis/unsafe.sig 11 | ../../common/basis/unsafe.sml 12 | end 13 | -------------------------------------------------------------------------------- /lib/stubs/mlkit/mlton/sources.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a BSD-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | local 8 | $(SML_LIB)/basis/basis.mlb 9 | ../../common/mlton/process-via-fork-exec.sml 10 | in 11 | mlton.sml 12 | end 13 | -------------------------------------------------------------------------------- /regression/flat-vector.sml: -------------------------------------------------------------------------------- 1 | val v = Vector.tabulate (10, 2 | (fn x => 3 | let 4 | fun toChar x = Char.chr (Char.ord #"0" + x) 5 | in 6 | (toChar 0, toChar x) 7 | end)) 8 | val x = Vector.sub (v, 8) 9 | val _ = print "should be 08\n" 10 | val _ = print (str (#1 x) ^ str (#2 x) ^ "\n") 11 | -------------------------------------------------------------------------------- /lib/mlton/basic/signal.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature SIGNAL = 9 | sig 10 | include MLTON_SIGNAL 11 | end 12 | -------------------------------------------------------------------------------- /regression/fail/eqtype.1.sml: -------------------------------------------------------------------------------- 1 | (* This should fail because v is an eqtype and s does not admit equality. 2 | * Hence, the side condition on rule 64 fails. 3 | *) 4 | signature T = 5 | sig 6 | type s 7 | structure V: 8 | sig 9 | datatype v = V 10 | end where type v = s 11 | end 12 | -------------------------------------------------------------------------------- /regression/typespec.sml: -------------------------------------------------------------------------------- 1 | (* typespec.sml *) 2 | 3 | (* Checks scoping of definitional type specifications. *) 4 | 5 | type t = int 6 | 7 | signature S = 8 | sig 9 | type t = bool 10 | and u = t 11 | end 12 | 13 | structure X : S = 14 | struct 15 | type t = bool 16 | and u = bool 17 | end; 18 | -------------------------------------------------------------------------------- /runtime/gc/gap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2020 Sam Westrick 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | */ 6 | 7 | #if (defined (MLTON_GC_INTERNAL_FUNCS)) 8 | 9 | void fillGap(GC_state s, pointer start, pointer end); 10 | 11 | #endif /* MLTON_GC_INTERNAL_FUNCS */ 12 | -------------------------------------------------------------------------------- /basis-library/io/text-stream-io.sig: -------------------------------------------------------------------------------- 1 | signature TEXT_STREAM_IO = 2 | sig 3 | include STREAM_IO 4 | where type elem = Char.char 5 | where type vector = CharVector.vector 6 | 7 | val inputLine: instream -> (string * instream) option 8 | val outputSubstr: outstream * substring -> unit 9 | end 10 | -------------------------------------------------------------------------------- /lib/mlton/directed-graph/test.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Z = TestDirectedGraph (DirectedGraph) 9 | structure Z = struct end 10 | -------------------------------------------------------------------------------- /lib/stubs/smlnj/mlton/sources.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009,2022 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | Library 8 | 9 | structure MLton 10 | 11 | is 12 | 13 | $/basis.cm 14 | 15 | ../../common/mlton/process-via-fork-exec.sml 16 | mlton.sml 17 | -------------------------------------------------------------------------------- /regression/flat-array.3.sml: -------------------------------------------------------------------------------- 1 | val a = Array.tabulate (100, fn i => (i, real i)) 2 | 3 | val _ = Array.update (a, 0, (1, 100.0)) 4 | 5 | val i = #1 (Array.sub (a, 0)) + #1 (Array.sub (a, 1)) 6 | 7 | val x = #2 (Array.sub (a, 0)) + #2 (Array.sub (a, 1)) 8 | 9 | val () = print (concat [Int.toString i, " ", Real.toString x, "\n"]) 10 | 11 | -------------------------------------------------------------------------------- /regression/int-inf.rep2.sml: -------------------------------------------------------------------------------- 1 | structure I = MLton.IntInf 2 | val bigthree = Vector.fromList (List.map I.BigWord.fromInt [0,3]) 3 | val three = case I.fromRep (I.Big bigthree) of SOME b3 => b3 | NONE => 3 4 | val () = case IntInf.compare (three, three + 1 - 1) of 5 | EQUAL => print "That's good\n" 6 | | _ => print "That's bad\n" 7 | -------------------------------------------------------------------------------- /runtime/gc/done.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | */ 8 | 9 | PRIVATE void GC_done (GC_state s); 10 | -------------------------------------------------------------------------------- /basis-library/config/bind/real-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Real32 = Primitive.Real32 9 | structure Real64 = Primitive.Real64 10 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/top-level/basis-funs.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | (* Required functors *) 9 | 10 | (* Optional functors *) 11 | -------------------------------------------------------------------------------- /regression/int-inf.4.sml: -------------------------------------------------------------------------------- 1 | fun dump (x: IntInf.int): unit = 2 | let val rest = IntInf.quot (x, 10) 3 | in (print o Int.toString o IntInf.toInt o IntInf.rem) (x, 10); 4 | if rest = 0 5 | then print "\n" 6 | else dump rest 7 | end 8 | 9 | val _ = dump 12345678901234567890 10 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/posix/flags.sig: -------------------------------------------------------------------------------- 1 | signature POSIX_FLAGS_1997 = 2 | sig 3 | eqtype flags 4 | 5 | val toWord: flags -> SysWord.word 6 | val wordTo: SysWord.word -> flags 7 | val flags: flags list -> flags 8 | val allSet: flags * flags -> bool 9 | val anySet: flags * flags -> bool 10 | end 11 | -------------------------------------------------------------------------------- /basis-library/libs/basis-none/top-level/infixes.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | infix 4 = 10 | -------------------------------------------------------------------------------- /bin/patch-mingw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | dir=`dirname "$0"` 6 | 7 | for f in `find "$dir" -type f | grep -v '\.svn' | grep -v '~'`; do 8 | if head -n 1 "$f" | grep -q '#!/usr/bin/env bash'; then 9 | echo "Processing $f" 10 | sed 's;#!/usr/bin/env bash;#!/usr/bin/env sh;' <"$f" >.tmp; 11 | mv .tmp "$f"; 12 | fi 13 | done 14 | -------------------------------------------------------------------------------- /lib/mlton/basic/char-pred.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature CHAR_FUN = 9 | sig 10 | type t = char -> 'a 11 | 12 | 13 | end 14 | -------------------------------------------------------------------------------- /lib/mlton/basic/dynamic-wind.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005, 2008 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure DynamicWind: DYNAMIC_WIND = 9 | struct 10 | 11 | yes 12 | 13 | end 14 | -------------------------------------------------------------------------------- /regression/int-inf.5.sml: -------------------------------------------------------------------------------- 1 | open IntInf MLton.IntInf 2 | 3 | fun p (a, b) = (print (toString (gcd (a, b))) 4 | ; print "\n") 5 | 6 | val _ = List.app p [(1000, 205), 7 | (1000000000000, 205), 8 | (100000000000000000000, 500000000), 9 | (100000000000000000000, 500000001)] 10 | -------------------------------------------------------------------------------- /basis-library/mlton/text-io.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature MLTON_TEXT_IO = MLTON_IO 10 | -------------------------------------------------------------------------------- /lib/mlton/basic/signal.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Signal = 9 | struct 10 | 11 | open MLton.Signal 12 | type t = signal 13 | 14 | end 15 | -------------------------------------------------------------------------------- /mlton/sources.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | local 10 | in 11 | main/sources.mlb 12 | end 13 | -------------------------------------------------------------------------------- /regression/ex.sml: -------------------------------------------------------------------------------- 1 | exception Foo of unit ref 2 | 3 | fun f (x, r): int = if x then raise (Foo r) 4 | else (f (true, r); 1 + 2) 5 | 6 | fun loop (r: unit ref): int = 7 | let val r' = ref () 8 | in if r = r' 9 | then 13 10 | else f (false, r') handle Foo r => loop r 11 | end 12 | 13 | val _ = loop (ref ()) 14 | -------------------------------------------------------------------------------- /regression/id.sml: -------------------------------------------------------------------------------- 1 | (* id.sml *) 2 | 3 | (* Checks parsing of identifiers. *) 4 | 5 | val ? = {* = op*, + = op+} 6 | val op* = # * ? 7 | val op+ = # + ?; 8 | 9 | type '& = ' list 10 | type t = int& 11 | type ''`` = '' 12 | type ('0,'_) == = '_`` &; 13 | 14 | fun !x=x=x 15 | fun ''`x:''=(x=x;x); 16 | 17 | infix v 18 | fun 3v? = 0 19 | | _v? = 1; 20 | -------------------------------------------------------------------------------- /regression/print-self.ok: -------------------------------------------------------------------------------- 1 | val K = "\nval _ = print (concat [\"val K = \\\"\", String.translate (fn #\"\\n\" => \"\\\\n\" | #\"\\\\\" => \"\\\\\\\\\" | #\"\\\"\" => \"\\\\\\\"\" | c => str c) K, \"\\\"\", K, \"\\n\"])" 2 | val _ = print (concat ["val K = \"", String.translate (fn #"\n" => "\\n" | #"\\" => "\\\\" | #"\"" => "\\\"" | c => str c) K, "\"", K, "\n"]) 3 | -------------------------------------------------------------------------------- /regression/print-self.sml: -------------------------------------------------------------------------------- 1 | val K = "\nval _ = print (concat [\"val K = \\\"\", String.translate (fn #\"\\n\" => \"\\\\n\" | #\"\\\\\" => \"\\\\\\\\\" | #\"\\\"\" => \"\\\\\\\"\" | c => str c) K, \"\\\"\", K, \"\\n\"])" 2 | val _ = print (concat ["val K = \"", String.translate (fn #"\n" => "\\n" | #"\\" => "\\\\" | #"\"" => "\\\"" | c => str c) K, "\"", K, "\n"]) 3 | -------------------------------------------------------------------------------- /basis-library/top-level/infixes-unsafe.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | infix 7 *! 10 | infix 6 +! -! 11 | -------------------------------------------------------------------------------- /lib/mlton/basic/mono-container.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature MONO_CONTAINER = 10 | sig 11 | end 12 | -------------------------------------------------------------------------------- /lib/mlton/basic/order.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature ORDER = 9 | sig 10 | include ORDER0 11 | val layout: t -> Layout.t 12 | end 13 | -------------------------------------------------------------------------------- /lib/stubs/polyml/basis/sources.use: -------------------------------------------------------------------------------- 1 | use "../../common/basis/real32-via-real.sml"; 2 | use "../../common/basis/real64-via-real.sml"; 3 | use "../../common/basis/pack-real32-dummy.sml"; 4 | use "../../common/basis/pack-real64-dummy.sml"; 5 | use "../../common/basis/pack-word64-dummy.sml"; 6 | use "../../common/basis/unsafe.sig"; 7 | use "../../common/basis/unsafe.sml"; 8 | -------------------------------------------------------------------------------- /regression/exn-history.ok: -------------------------------------------------------------------------------- 1 | f. exn-history.sml 3.18 2 | f exn-history.sml 1.5 3 | f exn-history.sml 1.5 4 | f exn-history.sml 1.5 5 | f exn-history.sml 1.5 6 | f exn-history.sml 1.5 7 | f exn-history.sml 1.5 8 | f exn-history.sml 1.5 9 | f exn-history.sml 1.5 10 | f exn-history.sml 1.5 11 | f exn-history.sml 1.5 12 | f exn-history.sml 1.5 13 |
14 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.1.sml: -------------------------------------------------------------------------------- 1 | (* This must fail, because the overloading context can be no larger than the 2 | * smallest enclosing strdec. So, the declaration of double must be resolved 3 | * (with type int -> int) before continuing. 4 | *) 5 | structure S = 6 | struct 7 | fun double x = x + x 8 | end 9 | val _ = S.double 2.0 10 | -------------------------------------------------------------------------------- /docs/rts/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Runtime System 4 | --- 5 | 6 | # The MaPLe Runtime System 7 | 8 | The runtime system broadly consists of two components: a scheduler, and a 9 | memory manager / garbage collector. These components are written in a combination 10 | of SML and C. See [Scheduling](sched) and [Memory Management](mem-manage). 11 | 12 | -------------------------------------------------------------------------------- /lib/stubs/smlnj/basis/pervasive.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | Library 8 | 9 | signature PERVASIVE_REAL 10 | structure Pervasive 11 | 12 | is 13 | 14 | #if (defined (SMLNJ_VERSION)) 15 | $/basis.cm 16 | #endif 17 | pervasive.sml 18 | -------------------------------------------------------------------------------- /regression/taut.sml: -------------------------------------------------------------------------------- 1 | (* a tautology checker *) 2 | 3 | datatype t = 4 | Base of bool 5 | | Fun of bool -> t 6 | 7 | val rec taut = 8 | fn Base b => b 9 | | Fun f => taut (f true) andalso taut (f false) 10 | 11 | val rec bigTrue = 12 | fn 0 => Base true 13 | | n => Fun (fn _ => bigTrue (n - 1)) 14 | 15 | val _ = taut (bigTrue 12) 16 | 17 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/io/text-stream-io.sig: -------------------------------------------------------------------------------- 1 | signature TEXT_STREAM_IO_1997 = 2 | sig 3 | include STREAM_IO_1997 4 | where type vector = CharVector.vector 5 | where type elem = Char.char 6 | 7 | val inputLine: instream -> string * instream 8 | (* 9 | val outputSubstr: outstream * substring -> unit 10 | *) 11 | end 12 | -------------------------------------------------------------------------------- /basis-library/top-level/infixes-overflow.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | infix 7 *? *$ 10 | infix 6 +? +$ -? -$ 11 | -------------------------------------------------------------------------------- /regression/date-localOffset.sml: -------------------------------------------------------------------------------- 1 | fun doit tz = 2 | let 3 | val () = MLton.ProcEnv.setenv {name = "TZ", value = tz} 4 | val lo = Date.localOffset () 5 | in 6 | app print 7 | ["TZ = ", tz, " :: Date.localOffset () = ", Time.toString lo, "\n"] 8 | end 9 | 10 | val () = doit "UTC+4" 11 | val () = doit "UTC+0" 12 | val () = doit "UTC-4" 13 | -------------------------------------------------------------------------------- /regression/disabled/pack.sml.disabled: -------------------------------------------------------------------------------- 1 | open Array MLton.GC 2 | 3 | val a = tabulate (100000, fn i => i) 4 | val _ = pack () 5 | val a' = tabulate (100, fn i => i) 6 | val _ = unpack () 7 | val _ = sub (a, 0) + sub (a, 1) 8 | val _ = sub (a', 0) + sub (a', 1) 9 | val a'' = tabulate (1000000, fn i => i) 10 | val _ = sub (a'', 0) + sub (a'', 1) 11 | val _ = print "OK\n" 12 | -------------------------------------------------------------------------------- /regression/unary.2.sml: -------------------------------------------------------------------------------- 1 | datatype num = Z | S of num 2 | 3 | val rec plus = 4 | fn (n, Z) => n 5 | | (n, S m) => S (plus (n,m)) 6 | 7 | val rec times = 8 | fn (_, Z) => Z 9 | | (n, S m) => plus (n, times (n,m)) 10 | 11 | val rec fact = 12 | fn Z => S Z 13 | | n as S m => times (n, fact m) 14 | 15 | val x = fact (S (S (S Z))) 16 | 17 | -------------------------------------------------------------------------------- /regression/withtype5.sml: -------------------------------------------------------------------------------- 1 | (* withtype.sml *) 2 | 3 | (* Checks scoping rules of withtype *) 4 | 5 | type u = int 6 | 7 | datatype t = T of u * v 8 | withtype u = bool 9 | and v = u 10 | 11 | val z = T(true, 6) 12 | val y : u = true 13 | val x : v = 1 14 | 15 | fun tEq (a: t, b: t) = a = b 16 | fun uEq (a: u, b: u) = a = b 17 | fun vEq (a: v, b: v) = a = b 18 | -------------------------------------------------------------------------------- /basis-library/config/bind/int-top.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Int8 = Int8 9 | structure Int16 = Int16 10 | structure Int32 = Int32 11 | structure Int64 = Int64 12 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/pervasive-exns.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | structure B : BASIS_2002_EXNS = Basis2002 10 | in 11 | open B 12 | end 13 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/pervasive-vals.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | structure B : BASIS_2002_VALS = Basis2002 10 | in 11 | open B 12 | end 13 | -------------------------------------------------------------------------------- /basis-library/pervasive.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | pervasive-types.mlb 9 | pervasive-exns.mlb 10 | pervasive-vals.mlb 11 | infixes.mlb 12 | equal.mlb 13 | overloads.mlb 14 | -------------------------------------------------------------------------------- /mlton/call-main.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * Copyright (C) 1997-2000 NEC Research Institute. 5 | * 6 | * MLton is released under a HPND-style license. 7 | * See the file MLton-LICENSE for details. 8 | *) 9 | 10 | val _ = Main.mainWrapped () 11 | -------------------------------------------------------------------------------- /mlton/main/main.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * Copyright (C) 1997-2000 NEC Research Institute. 5 | * 6 | * MLton is released under a HPND-style license. 7 | * See the file MLton-LICENSE for details. 8 | *) 9 | 10 | structure Main = Main () 11 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/pervasive-equal.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | structure B = Basis2002 : BASIS_2002_EQUAL 10 | in 11 | open B 12 | end 13 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002/top-level/pervasive-types.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | structure B : BASIS_2002_TYPES = Basis2002 10 | in 11 | open B 12 | end 13 | -------------------------------------------------------------------------------- /basis-library/net/net-serv-db.sig: -------------------------------------------------------------------------------- 1 | signature NET_SERV_DB = 2 | sig 3 | type entry 4 | val name: entry -> string 5 | val aliases: entry -> string list 6 | val port: entry -> int 7 | val protocol: entry -> string 8 | val getByName: string * string option -> entry option 9 | val getByPort: int * string option -> entry option 10 | end 11 | -------------------------------------------------------------------------------- /mlton/front-end/ml-yacc-lib-proxy.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | Library 8 | 9 | library(../../lib/mlyacc-lib/ml-yacc-lib.cm) - ( 10 | signature STREAM 11 | structure Stream 12 | ) 13 | 14 | is 15 | 16 | ../../lib/mlyacc-lib/ml-yacc-lib.cm 17 | -------------------------------------------------------------------------------- /runtime/gc/string.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | */ 8 | 9 | GC_header GC_stringHeader (void) { 10 | return GC_STRING_HEADER; 11 | } 12 | -------------------------------------------------------------------------------- /basis-library/config/bind/char-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Char8 = Primitive.Char8 9 | structure Char16 = Primitive.Char16 10 | structure Char32 = Primitive.Char32 11 | -------------------------------------------------------------------------------- /basis-library/config/bind/word-top.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Word8 = Word8 9 | structure Word16 = Word16 10 | structure Word32 = Word32 11 | structure Word64 = Word64 12 | -------------------------------------------------------------------------------- /basis-library/integer/int-global.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | structure IntGlobal: INTEGER_GLOBAL = Int 10 | open IntGlobal 11 | -------------------------------------------------------------------------------- /basis-library/integer/word-global.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | structure WordGlobal: WORD_GLOBAL = Word 10 | open WordGlobal 11 | -------------------------------------------------------------------------------- /basis-library/text/char-global.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | structure CharGlobal: CHAR_GLOBAL = Char 10 | open CharGlobal 11 | -------------------------------------------------------------------------------- /docker-bake.hcl: -------------------------------------------------------------------------------- 1 | group "default" { 2 | targets = ["amd64", "arm64"] 3 | } 4 | 5 | target "amd64" { 6 | dockerfile = "Dockerfile.amd64" 7 | tags = ["shwestrick/mpl:latest"] 8 | platforms = ["linux/amd64"] 9 | } 10 | 11 | target "arm64" { 12 | dockerfile = "Dockerfile.arm64" 13 | tags = ["shwestrick/mpl:latest"] 14 | platforms = ["linux/arm64"] 15 | } 16 | -------------------------------------------------------------------------------- /docs/rts/sched/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Scheduling 4 | parent: Runtime System 5 | --- 6 | 7 | # Scheduling 8 | 9 | MPL features a work-stealing scheduler which assigns tasks to processors. 10 | 11 | {: .todo} 12 | ... 13 | 14 | Main source location: [`basis-library/schedulers/par-pcall/`](https://github.com/MPLLang/mpl/tree/main/basis-library/schedulers/par-pcall/) -------------------------------------------------------------------------------- /lib/mlton/basic/export.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature EXPORT = 9 | sig 10 | val exportFn: File.t * (string * string list -> OS.Process.status) -> unit 11 | end 12 | -------------------------------------------------------------------------------- /mlton/atoms/var.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature VAR_STRUCTS = 10 | sig 11 | end 12 | 13 | signature VAR = ID 14 | -------------------------------------------------------------------------------- /mlton/sources.cm: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | Library 10 | 11 | structure Main 12 | 13 | is 14 | 15 | main/sources.cm 16 | 17 | -------------------------------------------------------------------------------- /basis-library/libs/basis-2002-strict/top-level/top-level.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | open Basis2002 10 | 11 | val op = = op = 12 | -------------------------------------------------------------------------------- /mlton/control/version_sml.src: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009,2013,2016,2018-2019 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure Version = 8 | struct 9 | val name = "MLTON_NAME" 10 | val version = "MLTON_VERSION" 11 | 12 | val banner = concat [name, " ", version] 13 | end 14 | -------------------------------------------------------------------------------- /regression/array7.sml: -------------------------------------------------------------------------------- 1 | (* This program tests the implementation of arrays whose length is important but 2 | * whose elements aren't. 3 | *) 4 | open Array 5 | val a = array (2, #"a") 6 | val _ = update (a, 0, #"b") 7 | val n = if sub (a, 0) = #"b" 8 | then 2 9 | else 1 10 | val _ = 11 | if 2 = length (array (n, 13)) 12 | then () 13 | else raise Fail "bug" 14 | -------------------------------------------------------------------------------- /runtime/basis/MLton/bug.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | /* print a bug message and exit (2) */ 4 | void MLton_bug (String8_t msg) { 5 | uintmax_t size = GC_getSequenceLength ((pointer)msg); 6 | fprintf (stderr, "MLton bug: "); 7 | fwrite ((const void*)msg, (size_t)size, 1, stderr); 8 | fprintf (stderr, "\nPlease send a bug report to MLton@mlton.org.\n"); 9 | exit (2); 10 | } 11 | -------------------------------------------------------------------------------- /runtime/basis/System/Time.c: -------------------------------------------------------------------------------- 1 | #include "platform.h" 2 | 3 | C_Int_t Time_getTimeOfDay (Ref(C_Time_t) sec, Ref(C_SUSeconds_t) usec) { 4 | struct timeval timeval; 5 | int res; 6 | res = gettimeofday (&timeval, (struct timezone*)NULL); 7 | if (! res) { 8 | *((C_Time_t*)sec) = timeval.tv_sec; 9 | *((C_SUSeconds_t*)usec) = timeval.tv_usec; 10 | } 11 | return res; 12 | } 13 | -------------------------------------------------------------------------------- /bin/run-docker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NAME="mpl-run-docker" 4 | 5 | # Remove any containers which already have $NAME. 6 | docker image rm $NAME 7 | 8 | # build container, and assign it tag $NAME 9 | PLATFORM=`uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/` 10 | docker build -t $NAME -f Dockerfile.$PLATFORM . 11 | 12 | # run container with the tag $NAME. 13 | docker run --rm -it $NAME 14 | -------------------------------------------------------------------------------- /lib/mlton/basic/t.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature T = 9 | sig 10 | type t 11 | 12 | val equals: t * t -> bool 13 | val layout: t -> Layout.t 14 | end 15 | -------------------------------------------------------------------------------- /lib/stubs/mlton-stubs/exn.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009,2022 Matthew Fluet. 2 | * Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature MLTON_EXN = 10 | sig 11 | val history: exn -> string list 12 | end 13 | -------------------------------------------------------------------------------- /mlton/xml/xml.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | functor Xml (S: XML_STRUCTS): XML = 10 | XmlSimplify (Shrink (TypeCheck (XmlTree (S)))) 11 | -------------------------------------------------------------------------------- /regression/FuhMishra.ok: -------------------------------------------------------------------------------- 1 | 2 | processing outFuhMishra0...running TYPE...running MATCH... 3 | processing outFuhMishra1...running TYPE...running MATCH... 4 | processing outFuhMishra2...running TYPE...running MATCH... 5 | processing outFuhMishra3...running TYPE...running MATCH... 6 | processing outFuhMishra4...running TYPE...running MATCH... 7 | processing outFuhMishra5...running TYPE...running MATCH... 8 | -------------------------------------------------------------------------------- /regression/array2.ok: -------------------------------------------------------------------------------- 1 | (0, 0, 1) 2 | (0, 1, 2) 3 | (0, 2, 3) 4 | (0, 3, 4) 5 | (1, 0, 5) 6 | (1, 1, 6) 7 | (1, 2, 7) 8 | (1, 3, 8) 9 | (2, 0, 9) 10 | (2, 1, 10) 11 | (2, 2, 11) 12 | (2, 3, 12) 13 | (0, 0, 13) 14 | (1, 0, 14) 15 | (2, 0, 15) 16 | (0, 1, 16) 17 | (1, 1, 17) 18 | (2, 1, 18) 19 | (0, 2, 19) 20 | (1, 2, 20) 21 | (2, 2, 21) 22 | (0, 3, 22) 23 | (1, 3, 23) 24 | (2, 3, 24) 25 | OKOK 26 | -------------------------------------------------------------------------------- /regression/date.ok: -------------------------------------------------------------------------------- 1 | 2 | File date.sml: Testing structure Date... 3 | This is the epoch (UTC): Thu Jan 01 00:00:00 1970 4 | The UTC millenium (UTC time): Sat Jan 01 00:00:00 2000 5 | The UTC millenium minus 5 sec: Fri Dec 31 23:59:55 1999 6 | test1 OK 7 | test2 OK 8 | test3 OK 9 | test4 OK 10 | test5 OK 11 | test6 OK 12 | test7 OK 13 | test8 OK 14 | -------------------------------------------------------------------------------- /basis-library/config/bind/string-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure String8 = Primitive.String8 9 | structure String16 = Primitive.String16 10 | structure String32 = Primitive.String32 11 | -------------------------------------------------------------------------------- /basis-library/mlton/weak.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2003-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature MLTON_WEAK = 9 | sig 10 | type 'a t 11 | 12 | val get: 'a t -> 'a option 13 | val new: 'a -> 'a t 14 | end 15 | -------------------------------------------------------------------------------- /bin/host-os: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | name=`basename "$0"` 5 | dir=`dirname "$0"` 6 | bin=`cd "$dir" && pwd` 7 | 8 | die () { 9 | echo >&2 "$1" 10 | exit 1 11 | } 12 | 13 | usage () { 14 | die "usage: $name" 15 | } 16 | 17 | case "$#" in 18 | 0) 19 | ;; 20 | *) 21 | usage 22 | ;; 23 | esac 24 | 25 | eval `"$bin/platform"` 26 | 27 | echo $HOST_OS 28 | -------------------------------------------------------------------------------- /lib/mlton/queue/persistent.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature PERSISTENT_QUEUE = 9 | sig 10 | include BASIC_PERSISTENT_QUEUE 11 | 12 | val deque: 'a t -> 'a * 'a t 13 | end 14 | -------------------------------------------------------------------------------- /bin/host-arch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | name=`basename "$0"` 5 | dir=`dirname "$0"` 6 | bin=`cd "$dir" && pwd` 7 | 8 | die () { 9 | echo >&2 "$1" 10 | exit 1 11 | } 12 | 13 | usage () { 14 | die "usage: $name" 15 | } 16 | 17 | case "$#" in 18 | 0) 19 | ;; 20 | *) 21 | usage 22 | ;; 23 | esac 24 | 25 | eval `"$bin/platform"` 26 | 27 | echo $HOST_ARCH 28 | -------------------------------------------------------------------------------- /lib/mlton/basic/escape.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature ESCAPE = 9 | sig 10 | type 'a t 11 | 12 | val escape: 'a t * 'a -> 'b 13 | val new: ('a t -> 'a) -> 'a 14 | end 15 | -------------------------------------------------------------------------------- /regression/fail/modules.49.sml: -------------------------------------------------------------------------------- 1 | signature SIG = 2 | sig 3 | type t 4 | end 5 | 6 | functor F (structure S1: SIG 7 | structure S2: SIG 8 | sharing S1 = S2) = 9 | struct 10 | end 11 | 12 | structure S1: SIG = struct type t = int end 13 | structure S2: SIG = struct type t = real end 14 | structure Z = F (structure S1 = S1 15 | structure S2 = S2) 16 | -------------------------------------------------------------------------------- /regression/flat-array.2.sml: -------------------------------------------------------------------------------- 1 | val n = 20 2 | 3 | val a = Array.tabulate (n, fn i => (i, Array.array (1, 1))) 4 | 5 | val (i, a') = Array.sub (a, 13) 6 | 7 | val _ = Array.update (a', 0, i + Array.sub (a', 0)) 8 | 9 | val _ = 10 | print (concat [Int.toString (#1 (Array.sub (a, 12))), " ", 11 | Int.toString (Array.sub (#2 (Array.sub (a, 13)), 0)), "\n"]) 12 | 13 | -------------------------------------------------------------------------------- /runtime/util/to-string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004-2008 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | */ 7 | 8 | PRIVATE const char* boolToString (bool b); 9 | PRIVATE char* intmaxToCommaString (intmax_t n); 10 | PRIVATE char* uintmaxToCommaString (uintmax_t n); 11 | -------------------------------------------------------------------------------- /basis-library/general/bool.sig: -------------------------------------------------------------------------------- 1 | signature BOOL_GLOBAL = 2 | sig 3 | datatype bool = datatype bool 4 | 5 | val not: bool -> bool 6 | end 7 | 8 | signature BOOL = 9 | sig 10 | include BOOL_GLOBAL 11 | 12 | val fromString: string -> bool option 13 | val scan: (char, 'a) StringCvt.reader -> (bool, 'a) StringCvt.reader 14 | val toString: bool -> string 15 | end 16 | -------------------------------------------------------------------------------- /basis-library/real/real-global.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | val real = Real.fromInt 10 | structure RealGlobal: REAL_GLOBAL = Real 11 | open RealGlobal 12 | -------------------------------------------------------------------------------- /basis-library/text/substring-global.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | structure SubstringGlobal: SUBSTRING_GLOBAL = Substring 10 | open SubstringGlobal 11 | -------------------------------------------------------------------------------- /lib/mlton/queue/unbounded-ephemeral.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | signature UNBOUNDED_EPHEMERAL_QUEUE = 9 | sig 10 | include EPHEMERAL_QUEUE 11 | 12 | val empty: unit -> 'a t 13 | end 14 | -------------------------------------------------------------------------------- /regression/fail/rank.sml: -------------------------------------------------------------------------------- 1 | local 2 | val f = let val f = (fn x => x) (fn x => x) 3 | in f 4 | end 5 | 6 | datatype t = A 7 | 8 | val g = fn x => let val d = #1 x 9 | val k = #2 x 10 | val s = f (d,k) 11 | val _ = if true then (d,k) else x 12 | in s 13 | end 14 | in 15 | val a : t * t = g (A,A) 16 | end -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/posix/posix.sig: -------------------------------------------------------------------------------- 1 | signature POSIX_1997 = 2 | sig 3 | structure Error: POSIX_ERROR 4 | structure Signal: POSIX_SIGNAL 5 | structure Process: POSIX_PROCESS_1997 6 | structure ProcEnv: POSIX_PROC_ENV 7 | structure FileSys: POSIX_FILE_SYS_1997 8 | structure IO: POSIX_IO_1997 9 | structure SysDB: POSIX_SYS_DB 10 | structure TTY: POSIX_TTY_1997 11 | end 12 | -------------------------------------------------------------------------------- /lib/mlton/basic/unit.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Unit: UNIT = 9 | struct 10 | 11 | type t = unit 12 | 13 | val equals = fn ((), ()) => true 14 | 15 | fun layout() = Layout.str"()" 16 | 17 | end 18 | -------------------------------------------------------------------------------- /basis-library/config/bind/int-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Int8 = Primitive.Int8 9 | structure Int16 = Primitive.Int16 10 | structure Int32 = Primitive.Int32 11 | structure Int64 = Primitive.Int64 12 | -------------------------------------------------------------------------------- /basis-library/util/unique-id.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature UNIQUE_ID = 10 | sig 11 | type t 12 | 13 | val new: unit -> t 14 | end 15 | -------------------------------------------------------------------------------- /basis-library/config/bind/word-prim.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Word8 = Primitive.Word8 9 | structure Word16 = Primitive.Word16 10 | structure Word32 = Primitive.Word32 11 | structure Word64 = Primitive.Word64 12 | -------------------------------------------------------------------------------- /basis-library/config/c/position.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Position = C_Off 9 | 10 | functor Position_ChooseIntN (A: CHOOSE_INT_ARG) : 11 | sig val f : Position.int A.t end = 12 | C_Off_ChooseIntN (A) 13 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/system/unix.sig: -------------------------------------------------------------------------------- 1 | signature UNIX_1997 = 2 | sig 3 | type proc 4 | type signal 5 | 6 | val executeInEnv: string * string list * string list -> proc 7 | val execute: string * string list -> proc 8 | val streamsOf: proc -> TextIO.instream * TextIO.outstream 9 | val reap: proc -> OS.Process.status 10 | val kill: proc * signal -> unit 11 | end 12 | -------------------------------------------------------------------------------- /lib/mlton/basic/field.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | functor Field(F: FIELD_STRUCTS): FIELD = 9 | struct 10 | 11 | structure U = Ring(F) 12 | 13 | open F U 14 | 15 | val op / = fn (x, y) => x * inverse y 16 | 17 | end 18 | -------------------------------------------------------------------------------- /lib/stubs/mlkit/basis/timer.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2022 Matthew Fluet. 2 | * 3 | * MLton is released under a BSD-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | structure Timer = 8 | struct 9 | open Timer 10 | val checkCPUTimes = fn (_ : cpu_timer) => 11 | {gc = {sys = Time.zeroTime, usr = Time.zeroTime}, 12 | nongc = {sys = Time.zeroTime, usr = Time.zeroTime}} 13 | end 14 | -------------------------------------------------------------------------------- /regression/opaque2.sml: -------------------------------------------------------------------------------- 1 | structure S :> sig type ('a,'b) t 2 | val f : ('a,'b) t -> ('b,'a) t 3 | val mk : 'a * 'b -> ('a,'b) t 4 | end 5 | = 6 | struct 7 | type ('a,'b) t = 'b * 'a 8 | fun f (x,y) = (y,x) 9 | fun mk (a,b) = (b,a) 10 | end 11 | 12 | val a = S.mk (5, "hello") 13 | 14 | val b = S.f a -------------------------------------------------------------------------------- /basis-library/util/dynamic-wind.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature DYNAMIC_WIND = 10 | sig 11 | val wind: (unit -> 'a) * (unit -> unit) -> 'a 12 | end 13 | -------------------------------------------------------------------------------- /examples/lib/ForkJoin.mlton.sml: -------------------------------------------------------------------------------- 1 | structure ForkJoin: 2 | sig 3 | val par: (unit -> 'a) * (unit -> 'b) -> 'a * 'b 4 | val parfor: int -> int * int -> (int -> unit) -> unit 5 | val alloc: int -> 'a array 6 | end = 7 | struct 8 | fun par (f, g) = (f (), g ()) 9 | fun parfor (g:int) (lo, hi) (f: int -> unit) = 10 | if lo >= hi then () else (f lo; parfor g (lo+1, hi) f) 11 | fun alloc n = ArrayExtra.alloc n 12 | end 13 | -------------------------------------------------------------------------------- /lib/mlton/basic/postscript.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature POSTSCRIPT = 10 | sig 11 | val makeHeader: {host: string, job: string, user: string} -> string 12 | end 13 | -------------------------------------------------------------------------------- /regression/fail/overloading-context.2.sml: -------------------------------------------------------------------------------- 1 | (* This program must fail because the semicolon means that the declarations 2 | * must be treated as two topdecs, not a single topdec leading to two strdec's. 3 | * This follows from the restriction on page 14 of the Definition that states 4 | * "No topdec may contain as an initial segment, a strdec followed by a 5 | * semicolon" 6 | *) 7 | fun double x = x + x; 8 | val y = double 2.0 9 | -------------------------------------------------------------------------------- /regression/rlimit.sml: -------------------------------------------------------------------------------- 1 | open MLton.Rlimit 2 | val _ = 3 | List.app 4 | (fn r => set (r, get r) handle _ => ()) 5 | [cpuTime, coreFileSize, dataSize, fileSize, (*lockedInMemorySize,*) 6 | numFiles, (*numProcesses,*) (*residentSetSize,*) stackSize, 7 | virtualMemorySize] 8 | 9 | val _ = print (concat 10 | [Bool.toString ((RLim.castToSysWord infinity) >= 0wxFFFF), 11 | "\n"]) 12 | -------------------------------------------------------------------------------- /basis-library/config/c/sys-word.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure SysWord = C_UIntmax 9 | 10 | functor SysWord_ChooseWordN (A: CHOOSE_WORDN_ARG) : 11 | sig val f : SysWord.word A.t end = 12 | C_UIntmax_ChooseWordN (A) 13 | -------------------------------------------------------------------------------- /basis-library/config/default/fixed-int.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure FixedInt = Int64 9 | 10 | functor FixedInt_ChooseIntN (A: CHOOSE_INTN_ARG) : 11 | sig val f : FixedInt.int A.t end = 12 | ChooseIntN_Int64 (A) 13 | -------------------------------------------------------------------------------- /basis-library/config/default/large-int.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure LargeInt = IntInf 9 | 10 | functor LargeInt_ChooseInt (A: CHOOSE_INT_ARG) : 11 | sig val f : LargeInt.int A.t end = 12 | ChooseInt_IntInf (A) 13 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/io/io-convert.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | functor IOConvert 9 | (structure IO: IO) : 10 | IO_1997 = 11 | struct 12 | open IO 13 | exception TerminatedStream 14 | end 15 | -------------------------------------------------------------------------------- /basis-library/system/os.sig: -------------------------------------------------------------------------------- 1 | signature OS = 2 | sig 3 | structure FileSys: OS_FILE_SYS 4 | structure Path: OS_PATH 5 | structure Process: OS_PROCESS 6 | structure IO: OS_IO 7 | eqtype syserror 8 | exception SysErr of string * syserror option 9 | val errorMsg: syserror -> string 10 | val errorName: syserror -> string 11 | val syserror: string -> syserror option 12 | end 13 | -------------------------------------------------------------------------------- /examples/lib/sources.mlton.mlb: -------------------------------------------------------------------------------- 1 | $(SML_LIB)/basis/basis.mlb 2 | 3 | local 4 | $(SML_LIB)/basis/build/sources.mlb 5 | in 6 | structure ArrayExtra = Array 7 | end 8 | ForkJoin.mlton.sml 9 | 10 | CommandLineArgs.sml 11 | Util.sml 12 | SeqBasis.sml 13 | Seq.sml 14 | BinarySearch.sml 15 | Merge.sml 16 | Quicksort.sml 17 | Mergesort.sml 18 | TreeMatrix.sml 19 | 20 | SampleSort.sml 21 | CountingSort.sml 22 | 23 | Geometry2D.sml 24 | -------------------------------------------------------------------------------- /lib/mlton/basic/outstream.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure Outstream: OUTSTREAM = 9 | struct 10 | 11 | open Outstream0 12 | 13 | fun layout _ = Layout.str "" 14 | 15 | end 16 | 17 | structure Out = Outstream 18 | -------------------------------------------------------------------------------- /lib/mlton/basic/port.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2009 Matthew Fluet. 2 | * Copyright (C) 1999-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | signature PORT = 10 | sig 11 | type t = int 12 | 13 | val equals: t * t -> bool 14 | val http: t 15 | end 16 | -------------------------------------------------------------------------------- /lib/mlton/pervasive/sources.mlb: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | local 9 | $(SML_LIB)/basis/basis.mlb 10 | pervasive.sml 11 | in 12 | signature PERVASIVE_REAL 13 | signature PERVASIVE_WORD 14 | structure Pervasive 15 | end 16 | -------------------------------------------------------------------------------- /mlton/ssa/ssa2.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * Copyright (C) 1997-2000 NEC Research Institute. 4 | * 5 | * MLton is released under a HPND-style license. 6 | * See the file MLton-LICENSE for details. 7 | *) 8 | 9 | functor Ssa2 (S: SSA2_STRUCTS): SSA2 = 10 | Simplify2 (Shrink2 (PrePasses2 ( 11 | TypeCheck2 (Analyze2 (SsaTree2 (S)))))) 12 | -------------------------------------------------------------------------------- /regression/jump.sml: -------------------------------------------------------------------------------- 1 | 2 | fun doit 2 = "zero" 3 | | doit 6 = "one" 4 | | doit 10 = "two" 5 | | doit 14 = "three" 6 | | doit 18 = "four" 7 | | doit 22 = "five" 8 | | doit 26 = "six" 9 | | doit 30 = "seven" 10 | | doit 34 = "eight" 11 | | doit 38 = "nine" 12 | | doit 42 = "ten" 13 | | doit _ = "big" 14 | 15 | val l = List.tabulate(50,fn i => i) 16 | 17 | val _ = List.app (fn i => print ((doit i) ^ "\n")) l 18 | -------------------------------------------------------------------------------- /basis-library/config/seqindex/seqindex-int32.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure SeqIndex = Int32 9 | 10 | functor SeqIndex_ChooseIntN (A: CHOOSE_INTN_ARG) : 11 | sig val f : SeqIndex.int A.t end = 12 | ChooseIntN_Int32 (A) 13 | -------------------------------------------------------------------------------- /basis-library/config/seqindex/seqindex-int64.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | structure SeqIndex = Int64 9 | 10 | functor SeqIndex_ChooseIntN (A: CHOOSE_INTN_ARG) : 11 | sig val f : SeqIndex.int A.t end = 12 | ChooseIntN_Int64 (A) 13 | -------------------------------------------------------------------------------- /basis-library/libs/basis-1997/system/process-convert.fun: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2002-2006 Henry Cejtin, Matthew Fluet, Suresh 2 | * Jagannathan, and Stephen Weeks. 3 | * 4 | * MLton is released under a HPND-style license. 5 | * See the file MLton-LICENSE for details. 6 | *) 7 | 8 | functor OSProcessConvert 9 | (structure Process : OS_PROCESS) : 10 | OS_PROCESS_1997 = 11 | struct 12 | open Process 13 | end 14 | -------------------------------------------------------------------------------- /mlton/atoms/tyvar.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2017 Matthew Fluet. 2 | * Copyright (C) 1999-2005, 2008 Henry Cejtin, Matthew Fluet, Suresh 3 | * Jagannathan, and Stephen Weeks. 4 | * Copyright (C) 1997-2000 NEC Research Institute. 5 | * 6 | * MLton is released under a HPND-style license. 7 | * See the file MLton-LICENSE for details. 8 | *) 9 | 10 | signature TYVAR_STRUCTS = 11 | sig 12 | end 13 | 14 | signature TYVAR = ID 15 | -------------------------------------------------------------------------------- /mlton/backend/rssa-simplify.sig: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2019 Matthew Fluet. 2 | * 3 | * MLton is released under a HPND-style license. 4 | * See the file MLton-LICENSE for details. 5 | *) 6 | 7 | signature RSSA_SIMPLIFY_STRUCTS = 8 | sig 9 | include RSSA_RESTORE 10 | end 11 | 12 | signature RSSA_SIMPLIFY = 13 | sig 14 | include RSSA_SIMPLIFY_STRUCTS 15 | 16 | val simplify: Program.t -> Program.t 17 | end 18 | --------------------------------------------------------------------------------