Skip to content

Commit

Permalink
Merge branch 'master' into issue_166_string_ops
Browse files Browse the repository at this point in the history
  • Loading branch information
kanaka committed Feb 24, 2016
2 parents 82e2b26 + aebe1e8 commit 9044b1f
Show file tree
Hide file tree
Showing 114 changed files with 3,469 additions and 166 deletions.
101 changes: 57 additions & 44 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
.bash_history
.cache
.mal-history
.crystal
.lein
.m2
.ivy2
.sbt
*/experiments
*/node_modules
c/*.o
*.o
*.pyc
bash/mal.sh
c/mal
coffee/mal.coffee
crystal/mal
d/mal
erlang/mal
haskell/mal
haxe/*.n
haxe/*.py
haxe/cpp/
haxe/*.js
js/mal.js
js/web/mal.js
make/mal.mk
mal/mal.mal
nim/mal
php/mal.php
python/mal.py
*/step0_repl
*/step1_read_print
*/step2_eval
Expand All @@ -31,52 +21,75 @@ python/mal.py
*/step8_macros
*/step9_try
*/stepA_mal
*/mal
awk/mal.awk
bash/mal.sh
clojure/mal.jar
clojure/target
clojure/.lein-repl-history
coffee/mal.coffee
cs/*.exe
cs/*.dll
cs/*.mdb
clojure/target
clojure/.lein-repl-history
d/*.o
elixir/_build
elixir/deps
elixir/erl_crash.dump
elixir/*.ez
erlang/ebin
erlang/.rebar
erlang/src/*.beam
es6/mal.js
es6/build
factor/mal.factor
forth/mal.fs
fsharp/*.exe
fsharp/*.dll
fsharp/*.mdb
go/step*
go/mal
groovy/*.class
groovy/mal.jar
haskell/*.hi
haskell/*.o
haxe/*.n
haxe/*.py
haxe/cpp/
haxe/*.js
java/mal.jar
java/target/
java/dependency-reduced-pom.xml
js/mal.js
js/web/mal.js
kotlin/*.jar
kotlin/.idea
kotlin/*.iml
lua/lib
lua/linenoise.so
lua/mal.lua
make/mal.mk
mal/mal.mal
miniMAL/mal.json
nim/nimcache*
ocaml/*.cmi
ocaml/*.cmo
ocaml/*.swp
ocaml/*.cmx
ocaml/*.o
ocaml/mal_lib.*
perl/mal.pl
php/mal.php
ps/mal.ps
python/mal.pyz
r/mal.r
ruby/mal.rb
rust/target/
rust/mal
rust/Cargo.lock
rust/.cargo
r/lib
vb/*.exe
vb/*.dll
scala/mal.jar
scala/target
scala/project
haskell/*.hi
haskell/*.o
lua/lib
lua/linenoise.so
nim/nimcache*
.lein
.m2
.ivy2
.sbt
groovy/*.class
.crystal
es6/build
elixir/_build
elixir/deps
elixir/erl_crash.dump
elixir/*.ez
kotlin/*.jar
kotlin/.idea
kotlin/*.iml
tcl/mal.tcl
vb/*.exe
vb/*.dll
vimscript/mal.vim
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ matrix:
- {env: IMPL=rust, services: [docker]}
- {env: IMPL=scala, services: [docker]}
- {env: IMPL=swift NO_DOCKER=1, os: osx, osx_image: xcode7}
- {env: IMPL=swift3, services: [docker]}
- {env: IMPL=tcl, services: [docker]}
- {env: IMPL=vb, services: [docker]}
- {env: IMPL=vimscript, services: [docker]}
Expand Down
58 changes: 50 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mal_TEST_OPTS = --start-timeout 60 --test-timeout 120
IMPLS = awk bash c d clojure coffee cpp crystal cs erlang elixir es6 \
factor forth fsharp go groovy guile haskell haxe java julia \
js kotlin lua make mal ocaml matlab miniMAL nim perl php ps \
python r racket rpython ruby rust scala swift tcl vb vimscript
python r racket rpython ruby rust scala swift swift3 tcl vb vimscript

step0 = step0_repl
step1 = step1_read_print
Expand Down Expand Up @@ -57,28 +57,33 @@ STEP5_EXCLUDES += awk # completes at 10,000
STEP5_EXCLUDES += bash # no stack exhaustion or completion
STEP5_EXCLUDES += c # segfault
STEP5_EXCLUDES += cpp # completes at 10,000
STEP5_EXCLUDES += crystal # test completes, even at 1,000,000
STEP5_EXCLUDES += cs # fatal stack overflow fault
STEP5_EXCLUDES += d # completes at 10,000, fatal stack overflow at 1,000,000
STEP5_EXCLUDES += erlang # erlang is TCO, test passes
STEP5_EXCLUDES += elixir # elixir is TCO, test passes
STEP5_EXCLUDES += fsharp # completes at 10,000, fatal stack overflow at 100,000
STEP5_EXCLUDES += go # test completes, even at 100,000
STEP5_EXCLUDES += haskell # test completes
STEP5_EXCLUDES += make # no TCO capability/step
STEP5_EXCLUDES += mal # no TCO capability/step
STEP5_EXCLUDES += matlab # too slow to complete 10,000
STEP5_EXCLUDES += miniMAL # strange error with runtest.py
STEP5_EXCLUDES += nim # test completes, even at 100,000
STEP5_EXCLUDES += go # test completes, even at 100,000
STEP5_EXCLUDES += php # test completes, even at 100,000
STEP5_EXCLUDES += racket # test completes
STEP5_EXCLUDES += ruby # test completes, even at 100,000
STEP5_EXCLUDES += rust # no catching stack overflows
STEP5_EXCLUDES += swift3 # no catching stack overflows
STEP5_EXCLUDES += ocaml # test completes, even at 1,000,000
STEP5_EXCLUDES += vb # completes at 10,000
STEP5_EXCLUDES += crystal # test completes, even at 1,000,000

PERF_EXCLUDES = mal # TODO: fix this

dist_EXCLUDES += mal
# TODO: still need to implement dist
dist_EXCLUDES += guile io julia matlab swift

#
# Utility functions
#
Expand Down Expand Up @@ -147,6 +152,7 @@ ruby_STEP_TO_PROG = ruby/$($(1)).rb
rust_STEP_TO_PROG = rust/target/release/$($(1))
scala_STEP_TO_PROG = scala/$($(1)).scala
swift_STEP_TO_PROG = swift/$($(1))
swift3_STEP_TO_PROG = swift3/$($(1))
tcl_STEP_TO_PROG = tcl/$($(1)).tcl
vb_STEP_TO_PROG = vb/$($(1)).exe
vimscript_STEP_TO_PROG = vimscript/$($(1)).vim
Expand Down Expand Up @@ -180,6 +186,8 @@ forth_RUNSTEP = gforth ../$(2) $(3)
fsharp_RUNSTEP = mono ../$(2) --raw $(3)
go_RUNSTEP = ../$(2) $(3)
groovy_RUNSTEP = groovy ../$(2) $(3)
# needs TERM=dumb to work with readline
guile_RUNSTEP = guile --no-auto-compile -L ../guile ../$(2) $(3)
haskell_RUNSTEP = ../$(2) $(3)
haxe_RUNSTEP = python3 ../$(2) $(3)
haxe_RUNSTEP = $(haxe_RUNSTEP_$(HAXE_MODE))
Expand All @@ -205,11 +213,10 @@ ruby_RUNSTEP = ruby ../$(2) $(3)
rust_RUNSTEP = ../$(2) $(3)
scala_RUNSTEP = sbt 'run-main $($(1))$(if $(3), $(3),)'
swift_RUNSTEP = ../$(2) $(3)
swift3_RUNSTEP = ../$(2) $(3)
tcl_RUNSTEP = tclsh ../$(2) --raw $(3)
vb_RUNSTEP = mono ../$(2) --raw $(3)
vimscript_RUNSTEP = ./run_vimscript.sh ../$(2) $(3)
# needs TERM=dumb to work with readline
guile_RUNSTEP = guile --no-auto-compile -L ../guile ../$(2) $(3)


vimscript_TEST_OPTS = --test-timeout 30
Expand All @@ -227,9 +234,6 @@ ALL_TESTS = $(filter-out $(foreach impl,$(STEP5_EXCLUDES),test^$(impl)^step5),\
$(foreach impl,$(DO_IMPLS),\
$(foreach step,$(STEPS),test^$(impl)^$(step))))))

IMPL_STATS = $(foreach impl,$(DO_IMPLS),stats^$(impl))
IMPL_STATS_LISP = $(foreach impl,$(DO_IMPLS),stats-lisp^$(impl))

DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl))

IMPL_PERF = $(foreach impl,$(filter-out $(PERF_EXCLUDES),$(DO_IMPLS)),perf^$(impl))
Expand Down Expand Up @@ -292,6 +296,17 @@ $(IMPL_STATS_LISP):
echo "Stats (lisp only) for $(impl):"; \
$(MAKE) --no-print-directory -C $(impl) stats-lisp)

# dist rules

dist: $(IMPL_DIST)

.SECONDEXPANSION:
$(IMPL_DIST):
@echo "----------------------------------------------"; \
$(foreach impl,$(word 2,$(subst ^, ,$(@))),\
echo "Running: make -C $(impl) dist"; \
$(MAKE) --no-print-directory -C $(impl) dist)

# Docker build rules

docker-build: $(DOCKER_BUILD)
Expand Down Expand Up @@ -334,3 +349,30 @@ $(ALL_REPL): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(su
echo 'REPL implementation $(impl), step file: $+'; \
echo 'Running: $(call $(impl)_RUNSTEP,$(step),$(+))'; \
$(call $(impl)_RUNSTEP,$(step),$(+));))


# Recursive rules (call make FOO in each subdirectory)

define recur_template
.PHONY: $(1)
$(1): $(2)
.SECONDEXPANSION:
$(2):
@echo "----------------------------------------------"; \
$$(foreach impl,$$(word 2,$$(subst ^, ,$$(@))),\
echo "Running: $$(MAKE) --no-print-directory -C $$(impl) $(1)"; \
$$(MAKE) --no-print-directory -C $$(impl) $(1))
endef

recur_impls_ = $(filter-out $(foreach impl,$($(1)_EXCLUDES),$(1)^$(impl)),$(foreach impl,$(IMPLS),$(1)^$(impl)))

# recursive clean
$(eval $(call recur_template,clean,$(call recur_impls_,clean)))

# recursive stats
$(eval $(call recur_template,stats,$(call recur_impls_,stats)))
$(eval $(call recur_template,stats-lisp,$(call recur_impls_,stats-lisp)))

# recursive dist
$(eval $(call recur_template,dist,$(call recur_impls_,dist)))

17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Mal is a Clojure inspired Lisp interpreter.

Mal is implemented in 45 different languages:
Mal is implemented in 46 languages:

* GNU awk
* Bash shell
Expand Down Expand Up @@ -50,6 +50,7 @@ Mal is implemented in 45 different languages:
* Rust
* Scala
* Swift
* Swift 3
* Tcl
* Vimscript
* Visual Basic.NET
Expand Down Expand Up @@ -371,7 +372,7 @@ julia stepX_YYY.jl

*The Kotlin implementation was created by [Javier Fernandez-Ivern](https://github.com/ivern)*

The Kotlin implementation of mal has been tested with Kotlin 1.0.0-beta.
The Kotlin implementation of mal has been tested with Kotlin 1.0.

```
cd kotlin
Expand Down Expand Up @@ -575,6 +576,18 @@ make
./stepX_YYY
```

### Swift 3

The Swift 3 implementation of mal requires the Swift 3.0 compiler. It
has been tested with the development version of the Swift 3 from
2016-02-08.

```
cd swift3
make
./stepX_YYY
```

### Tcl 8.6

*The Tcl implementation was created by [Dov Murik](https://github.com/dubek)*
Expand Down
14 changes: 12 additions & 2 deletions awk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ SOURCES_BASE = types.awk reader.awk printer.awk
SOURCES_LISP = env.awk core.awk stepA_mal.awk
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)

all: mal.awk
all:
true

dist: mal.awk mal

mal.awk: $(SOURCES)
echo "#!/usr/bin/awk -f" > $@
echo 'arbitrary_long_name==0 "exec" "/usr/bin/gawk" "-O" "-f" "$$0" "$$@"' > $@
cat $+ | grep -v "^@include " >> $@

mal: mal.awk
echo '#!/bin/sh' > $@
cat $< >> $@
chmod +x $@

clean:
rm -f mal.awk mal


.PHONY: stats tests $(TESTS)

Expand Down
12 changes: 9 additions & 3 deletions bash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ SOURCES_BASE = types.sh reader.sh printer.sh
SOURCES_LISP = env.sh core.sh stepA_mal.sh
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)

all: mal.sh
all:
true

dist: mal.sh mal

mal.sh: $(SOURCES)
cat $+ | grep -v "^source " > $@

mal: mal.sh
echo "#!/usr/bin/env bash" > $@
cat $+ | grep -v "^source " >> $@
cat $< >> $@
chmod +x $@

clean:
rm -f mal.sh
rm -f mal.sh mal

.PHONY: stats

Expand Down
4 changes: 3 additions & 1 deletion c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ LDFLAGS += -l$(RL_LIBRARY) $(GLIB_LDFLAGS) -ldl -lffi

#####################

all: $(BINS) mal
all: $(BINS)

dist: mal

mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
Expand Down
Loading

0 comments on commit 9044b1f

Please sign in to comment.