Skip to content

Commit

Permalink
sml: init
Browse files Browse the repository at this point in the history
  • Loading branch information
ii8 committed Nov 29, 2023
1 parent 67b13a5 commit 5eb42b6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
14 changes: 14 additions & 0 deletions benchmark/helloworld/sml/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions benchmark/helloworld/sml/hello.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print "Hello, World!\n"
53 changes: 53 additions & 0 deletions lang/sml
Original file line number Diff line number Diff line change
@@ -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)")
"""

0 comments on commit 5eb42b6

Please sign in to comment.