aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-03-04 04:17:43 +0100
committerdef <dennis@felsin9.de>2015-03-04 04:39:43 +0100
commita2cd0a3adae2ccf2566122bcd90230d905ab59dc (patch)
treea68fc31f5c41381c910cd5f14b9fa166f84f9755
parent4ce9e165bafb4f14b03624f515066c3c42719dd9 (diff)
downloadmal-a2cd0a3adae2ccf2566122bcd90230d905ab59dc.tar.gz
mal-a2cd0a3adae2ccf2566122bcd90230d905ab59dc.zip
Add instructions and makefile for Nim
-rw-r--r--Makefile5
-rw-r--r--README.md16
-rw-r--r--nim/Makefile33
-rw-r--r--nim/mal.nimble2
4 files changed, 51 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index de9e2e5..6bfd582 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ EXCLUDE_TESTS += test^php^step5 # test completes, even at 100,000
EXCLUDE_TESTS += test^ruby^step5 # test completes, even at 100,000
EXCLUDE_TESTS += test^rust^step5 # no catching stack overflows
EXCLUDE_TESTS += test^ocaml^step5 # test completes, even at 1,000,000
-#EXCLUDE_TESTS += test^nim^step5 # test completes, even at 100,000
+EXCLUDE_TESTS += test^nim^step5 # test completes, even at 100,000
# interop tests now implemented yet
EXCLUDE_TESTS += test^cs^stepA test^java^stepA test^mal^stepA \
@@ -111,8 +111,7 @@ ruby_RUNSTEP = ruby ../$(2) $(3)
rust_RUNSTEP = ../$(2) $(3)
scala_RUNSTEP = sbt 'run-main $($(1))$(if $(3), $(3),)'
vb_RUNSTEP = mono ../$(2) --raw $(3)
-#nim_RUNSTEP = ../$(2) $(3)
-nim_RUNSTEP = nim -d:release --deadcodeelim:off c -r ../$(2) $(3)
+nim_RUNSTEP = ../$(2) $(3)
# Extra options to pass to runtest.py
cs_TEST_OPTS = --redirect
diff --git a/README.md b/README.md
index 612743c..b35a4ae 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
Mal is an Clojure inspired Lisp interpreter.
-Mal is implemented in 26 different languages:
+Mal is implemented in 27 different languages:
* Bash shell
* C
@@ -21,6 +21,7 @@ Mal is implemented in 26 different languages:
* mal itself
* MATLAB
* [miniMAL](https://github.com/kanaka/miniMAL)
+* Nim
* OCaml
* Perl
* PHP
@@ -190,6 +191,19 @@ cd make
make -f stepX_YYY.mk
```
+### Nim 0.10.3
+
+Running the Nim implementation of mal requires Nim's current devel branch
+(0.10.3) or later, and the nre library installed.
+
+```
+cd nim
+make
+ # OR
+nimble build
+./stepX_YYY
+```
+
### OCaml 4.01.0
```
diff --git a/nim/Makefile b/nim/Makefile
new file mode 100644
index 0000000..1da1ae6
--- /dev/null
+++ b/nim/Makefile
@@ -0,0 +1,33 @@
+#####################
+
+SOURCES_BASE = types.nim reader.nim printer.nim
+SOURCES_LISP = env.nim core.nim stepA_interop.nim
+SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
+
+#####################
+
+SRCS = step0_repl.nim step1_read_print.nim step2_eval.nim step3_env.nim \
+ step4_if_fn_do.nim step5_tco.nim step6_file.nim step7_quote.nim \
+ step8_macros.nim step9_try.nim stepA_interop.nim
+BINS = $(SRCS:%.nim=%)
+
+#####################
+
+all: $(BINS) mal
+
+mal: $(word $(words $(BINS)),$(BINS))
+ cp $< $@
+
+$(BINS):
+ nim -d:release c $@
+
+clean:
+ rm -rf nimcache/ $(BINS)
+ rm -f mal
+
+.PHONY: stats stats-lisp
+
+stats: $(SOURCES)
+ @wc $^
+stats-lisp: $(SOURCES_LISP)
+ @wc $^
diff --git a/nim/mal.nimble b/nim/mal.nimble
index 8c7028d..db35b0b 100644
--- a/nim/mal.nimble
+++ b/nim/mal.nimble
@@ -8,4 +8,4 @@ license = "MIT"
bin = "step0_repl, step1_read_print, step2_eval, step3_env, step4_if_fn_do, step5_tco, step6_file, step7_quote, step8_macros, step9_try, stepA_interop"
[Deps]
-Requires = "nim >= 0.10.0, nre >= 0.6.0"
+Requires = "nim >= 0.10.3, nre >= 0.6.0"