Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mal implementation by Crystal #70

Merged
merged 31 commits into from
Jun 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
58b84dd
crystal: Prepare to implement with Crystal
rhysd May 1, 2015
85c1b0c
crystal: implement step0
rhysd May 1, 2015
2c436e3
crystal: implement mal in Mal module
rhysd May 2, 2015
fdf28b7
crystal: basic implementation of step1
rhysd May 4, 2015
448769e
crystal: add symbols and fix ignoring comment
rhysd May 4, 2015
afc3a8d
crystal: add vector and hash-map, fix with-meta and error output
rhysd May 4, 2015
eec5fc4
crystal: implement step2
rhysd May 4, 2015
b26be02
crystal: implement step3 basic functionality
rhysd May 5, 2015
e014087
crystal: allow Vector in binding of 'let*'
rhysd May 6, 2015
66f3d7a
crystal: read_*() functions are member of Reader class
rhysd May 6, 2015
095b73e
crystal: start step4, implement 'do', 'if' and 'fn*'
rhysd May 7, 2015
bed6306
crystal: eval all types, not only a list
rhysd May 9, 2015
b31653d
crystal: make core.cr and implement +, -, *, /, list, list?, empty?, …
rhysd May 10, 2015
7fe6282
crystal: define Mal::Type class instead of simple alias of union
rhysd May 11, 2015
2c76c2f
crystal: refactor member names and errors
rhysd May 12, 2015
9b8a3da
crystal: add relational operators
rhysd May 12, 2015
4499e5c
crystal: add "&" param and 'not' function
rhysd May 12, 2015
51be500
crystal: complete step4
rhysd May 13, 2015
436f169
crystal: implemented step5
rhysd May 21, 2015
d21ef94
crystal: implement step6
rhysd May 23, 2015
9d627bc
crystal: fix hashmap
rhysd May 23, 2015
ce0696d
crystal: implement step7
rhysd May 23, 2015
9bbb8cc
crystal: implement step8
rhysd May 24, 2015
4f725b5
crystal: improve error message
rhysd May 24, 2015
1ec3465
crystal: implement step9
rhysd May 26, 2015
09fb509
crystal: refactor by adding Array to Mal type conversion
rhysd May 28, 2015
6e7390b
crystal: all tests for stepA pass
rhysd May 28, 2015
86fe631
crystal: fix Makefile to build all steps
rhysd May 29, 2015
b9e204b
crystal: `make MAL_IMPL=crystal test^mal` succeeds finally
rhysd Jun 1, 2015
725ee0b
crystal: fix early steps broken because of later refactoring
rhysd Jun 2, 2015
97d0deb
crystal: fix for Crystal 0.7.2
rhysd Jun 3, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ nim/nimcache
.ivy2
.sbt
groovy/*.class
.crystal
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PYTHON = python
# Settings
#

IMPLS = bash c clojure coffee cpp cs erlang factor forth go groovy \
IMPLS = bash c clojure coffee cpp crystal cs erlang factor forth go groovy \
haskell java julia js lua make mal ocaml matlab miniMAL nim \
perl php ps python r racket ruby rust scala swift vb guile

Expand Down Expand Up @@ -43,6 +43,7 @@ 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^vb^step5 # completes at 10,000
EXCLUDE_TESTS += test^crystal^step5 # test completes, even at 1,000,000

EXCLUDE_PERFS = perf^mal # TODO: fix this

Expand All @@ -57,6 +58,7 @@ c_STEP_TO_PROG = c/$($(1))
clojure_STEP_TO_PROG = clojure/src/$($(1)).clj
coffee_STEP_TO_PROG = coffee/$($(1)).coffee
cpp_STEP_TO_PROG = cpp/$($(1))
crystal_STEP_TO_PROG = crystal/$($(1))
cs_STEP_TO_PROG = cs/$($(1)).exe
erlang_STEP_TO_PROG = erlang/$($(1))
factor_STEP_TO_PROG = factor/src/$($(1))/$($(1)).factor
Expand Down Expand Up @@ -98,6 +100,7 @@ c_RUNSTEP = ../$(2) $(3)
clojure_RUNSTEP = lein with-profile +$(1) trampoline run $(3)
coffee_RUNSTEP = coffee ../$(2) $(3)
cpp_RUNSTEP = ../$(2) $(3)
crystal_RUNSTEP = ../$(2) $(3)
cs_RUNSTEP = mono ../$(2) --raw $(3)
erlang_RUNSTEP = ../$(2) $(3)
factor_RUNSTEP = factor ../$(2) $(3)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ cd coffee
coffee ./stepX_YYY
```

### Crystal

```
cd crystal
crystal run ./stepX_YYY.cr
```

### Erlang

*The Erlang implementation was created by [Nathan Fiedler (nlfiedler)](https://github.com/nlfiedler)*
Expand Down
26 changes: 26 additions & 0 deletions crystal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
STEPS = step0_repl.cr step1_read_print.cr step2_eval.cr step3_env.cr \
step4_if_fn_do.cr step5_tco.cr step6_file.cr step7_quote.cr \
step8_macros.cr step9_try.cr stepA_mal.cr

STEP_BINS = $(STEPS:%.cr=%)
LAST_STEP_BIN = $(word $(words $(STEP_BINS)),$(STEP_BINS))

all: $(STEP_BINS) mal

mal: $(LAST_STEP_BIN)
cp $< $@

$(STEP_BINS): %: %.cr $(MAL_LIB)
crystal build --release $<

clean:
rm -rf $(STEP_BINS) mal .crystal

stats: $(MODULES) stepA_mal.cr
@wc $^

stats-lisp: env.cr core.cr stepA_mal.cr
@wc $^

.PHONY: all clean stats stats-lisp

Loading