From 5eb42b6fc1bab31a4edae51291627baf649d1425 Mon Sep 17 00:00:00 2001 From: murray Date: Wed, 29 Nov 2023 15:19:49 +0000 Subject: [PATCH] sml: init --- benchmark/helloworld/sml/Dockerfile | 14 ++++++++ benchmark/helloworld/sml/hello.sml | 1 + lang/sml | 53 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 benchmark/helloworld/sml/Dockerfile create mode 100644 benchmark/helloworld/sml/hello.sml create mode 100644 lang/sml diff --git a/benchmark/helloworld/sml/Dockerfile b/benchmark/helloworld/sml/Dockerfile new file mode 100644 index 0000000..9fcb2bd --- /dev/null +++ b/benchmark/helloworld/sml/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine:latest + +RUN apk --no-cache add gcc musl-dev +RUN apk --no-cache add gmp-dev +RUN wget https://github.com/ii8/mlton-builds/releases/download/git04d76908f/mlton-git04d76908f.x86_64-linux-musl.tar.gz \ + && tar -xf mlton-git04d76908f.x86_64-linux-musl.tar.gz \ + && cp -r mlton-git04d76908f.x86_64-linux-musl/* /usr/local/ + +COPY hello.sml hello.sml + +RUN mlton -link-opt -static hello.sml +RUN strip hello +RUN ./hello +RUN stat -c '"sml" -> %s' hello > result diff --git a/benchmark/helloworld/sml/hello.sml b/benchmark/helloworld/sml/hello.sml new file mode 100644 index 0000000..7b6ef9b --- /dev/null +++ b/benchmark/helloworld/sml/hello.sml @@ -0,0 +1 @@ +print "Hello, World!\n" diff --git a/lang/sml b/lang/sml new file mode 100644 index 0000000..f892434 --- /dev/null +++ b/lang/sml @@ -0,0 +1,53 @@ +language = "sml" +name = "Standard ML" +homepage = Just "https://smlfamily.github.io" +spec = Formal +status = Active + +impl = Standalone +domain = [ GeneralPurpose ] +platform = [ Linux, Windows, MacOS ] + +typing = Static +safety = TypeSafe +mm = AutomaticMM +everything = AMess + +paradigms = [ Imperative, Functional ] +parallelism = [ ] +features = [ Closures, MutableState, StructuralTyping, TypeInference, Exceptions, ParametricPoly ] +concurrency = [ ] +runtime = [ Stack, GarbageCollector, ErrorHandling, Abstraction ] + +orthogonality = Impressive +example = + """ + functor TreeParser (type instream + val input1 : instream -> char option + val lookahead : instream -> char option) = + struct + datatype tree = Leaf of char | Node of tree * tree + + fun nextis c cs = + case lookahead cs of + NONE => false + | SOME c' => c' = c + + fun parse cs = + case input1 cs of + NONE => raise Fail "invalid tree" + | SOME #"(" => + let + fun loop l r = + if nextis #")" cs + then (input1 cs; Node (l, r)) + else loop (Node (l, r)) (parse cs) + in + loop (parse cs) (parse cs) + end + | SOME c => Leaf c + end + + structure TP = TreeParser(TextIO) + val tree = TP.parse(TextIO.openString "(a(bc)d)") + """