mirror of
https://github.com/kanaka/mal.git
synced 2024-08-16 17:20:23 +03:00
SML: Step 0
This commit is contained in:
parent
e14697a1d9
commit
c4d1636b2f
@ -36,7 +36,7 @@ IMPLS = ada ada.2 awk bash basic bbc-basic c chuck clojure coffee common-lisp cp
|
||||
elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
|
||||
guile haskell haxe hy io janet java js jq julia kotlin livescript logo lua make mal \
|
||||
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
|
||||
plsql powershell prolog ps python python.2 r racket rexx rpython ruby rust scala scheme skew \
|
||||
plsql powershell prolog ps python python.2 r racket rexx rpython ruby rust scala scheme skew sml \
|
||||
swift swift3 swift4 swift5 tcl ts vala vb vhdl vimscript wasm wren yorick xslt zig
|
||||
|
||||
step5_EXCLUDES += bash # never completes at 10,000
|
||||
@ -173,6 +173,7 @@ rust_STEP_TO_PROG = impls/rust/$($(1))
|
||||
scala_STEP_TO_PROG = impls/scala/target/scala-2.11/classes/$($(1)).class
|
||||
scheme_STEP_TO_PROG = $(scheme_STEP_TO_PROG_$(scheme_MODE))
|
||||
skew_STEP_TO_PROG = impls/skew/$($(1)).js
|
||||
sml_STEP_TO_PROG = impls/sml/$($(1))
|
||||
swift_STEP_TO_PROG = impls/swift/$($(1))
|
||||
swift3_STEP_TO_PROG = impls/swift3/$($(1))
|
||||
swift4_STEP_TO_PROG = impls/swift4/$($(1))
|
||||
|
13
impls/sml/Makefile
Normal file
13
impls/sml/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
STEPS = step0_repl.sml
|
||||
|
||||
STEP_BINS = $(STEPS:%.sml=%)
|
||||
|
||||
all: $(STEP_BINS)
|
||||
|
||||
$(STEP_BINS): %: %.sml
|
||||
mosmlc $< main.sml -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(STEP_BINS) *.ui *.uo
|
||||
|
||||
.PHONY: all clean
|
1
impls/sml/main.sml
Normal file
1
impls/sml/main.sml
Normal file
@ -0,0 +1 @@
|
||||
val _ = repl ()
|
2
impls/sml/run
Executable file
2
impls/sml/run
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
exec $(dirname $0)/${STEP:-stepA_mal} "${@}"
|
23
impls/sml/step0_repl.sml
Normal file
23
impls/sml/step0_repl.sml
Normal file
@ -0,0 +1,23 @@
|
||||
fun READ s: string =
|
||||
s
|
||||
|
||||
fun EVAL s: string =
|
||||
s
|
||||
|
||||
fun PRINT s: string =
|
||||
s
|
||||
|
||||
fun rep s: string =
|
||||
(PRINT o EVAL o READ) s
|
||||
|
||||
fun repl () =
|
||||
let open TextIO
|
||||
in (
|
||||
print("user> ");
|
||||
case inputLine(stdIn) of
|
||||
SOME(line) => (
|
||||
print(rep(line) ^ "\n");
|
||||
repl ()
|
||||
)
|
||||
| NONE => ()
|
||||
) end
|
Loading…
Reference in New Issue
Block a user