Skip to content

Commit

Permalink
Merge pull request kanaka#262 from c0deaddict/master
Browse files Browse the repository at this point in the history
Livescript implementation
  • Loading branch information
kanaka authored May 24, 2017
2 parents a9083e6 + 78b2050 commit ebe3ff5
Show file tree
Hide file tree
Showing 26 changed files with 3,044 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ common-lisp/*.fasl
common-lisp/*.lib
common-lisp/images/*
common-lisp/hist/*
livescript/*.js
!livescript/node_readline.js
livescript/node_modules
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ matrix:
- {env: IMPL=js, services: [docker]}
- {env: IMPL=julia, services: [docker]}
- {env: IMPL=kotlin, services: [docker]}
- {env: IMPL=livescript, services: [docker]}
- {env: IMPL=logo, services: [docker]}
- {env: IMPL=lua, services: [docker]}
- {env: IMPL=make, services: [docker]}
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ IMPLS = ada awk bash basic c d chuck clojure coffee common-lisp cpp crystal cs d
haxe io java julia js kotlin logo lua make mal ocaml matlab miniMAL \
nim objc objpascal perl perl6 php pil plpgsql plsql powershell ps \
python r racket rpython ruby rust scala skew swift swift3 tcl ts vb vhdl \
vimscript
vimscript livescript

EXTENSION = .mal

Expand Down Expand Up @@ -215,6 +215,7 @@ vb_STEP_TO_PROG = vb/$($(1)).exe
vhdl_STEP_TO_PROG = vhdl/$($(1))
vimscript_STEP_TO_PROG = vimscript/$($(1)).vim
guile_STEP_TO_PROG = guile/$($(1)).scm
livescript_STEP_TO_PROG = livescript/$($(1)).js


# Needed some argument munging
Expand Down
15 changes: 14 additions & 1 deletion 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 64 languages:
Mal is implemented in 65 languages:

* Ada
* GNU awk
Expand Down Expand Up @@ -39,6 +39,7 @@ Mal is implemented in 64 languages:
* JavaScript ([Online Demo](http://kanaka.github.io/mal))
* Julia
* Kotlin
* LiveScript
* Logo
* Lua
* GNU Make
Expand Down Expand Up @@ -525,6 +526,18 @@ make
java -jar stepX_YYY.jar
```

### LiveScript

*The LiveScript implementation was created by [Jos van Bakel](https://github.com/c0deaddict)*

The LiveScript implementation of mal has been tested with LiveScript 1.5.

```
cd livescript
make
node_modules/.bin/lsc stepX_YYY.ls
```

### Logo

*The Logo implementation was created by [Dov Murik](https://github.com/dubek)*
Expand Down
31 changes: 31 additions & 0 deletions livescript/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:xenial
MAINTAINER Joel Martin <[email protected]>

##########################################################
# General requirements for testing or common across many
# implementations
##########################################################

RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python

# Some typical implementation and test requirements
RUN apt-get -y install curl libreadline-dev libedit-dev

RUN mkdir -p /mal
WORKDIR /mal

##########################################################
# Specific implementation requirements
##########################################################

# For building node modules
RUN apt-get -y install g++

# Add nodesource apt repo config for 7.X
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -

# Install nodejs
RUN apt-get -y install nodejs
40 changes: 40 additions & 0 deletions livescript/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SOURCES_BASE = reader.ls printer.ls env.ls core.ls utils.ls
SOURCES_STEPS = step0_repl.ls step1_read_print.ls step2_eval.ls \
step4_if_fn_do.ls step5_tco.ls step6_file.ls step7_quote.ls \
step8_macros.ls step9_try.ls stepA_mal.ls
SOURCES_LISP = env.ls core.ls stepA_mal.ls
SOURCES = $(SOURCES_BASE) $(SOURCES_STEPS)

BINS = $(SOURCES:%.ls=%.js)

LSC = node_modules/.bin/lsc

all: node_modules $(BINS)

node_modules:
npm install

%.js: %.ls node_modules
$(LSC) -d -c $(@:%.js=%.ls)

step1_read_print.js: utils.js reader.js printer.js
step2_eval.js: utils.js reader.js printer.js
step3_env.js: utils.js reader.js printer.js env.js
step4_if_fn_do.js: utils.js reader.js printer.js env.js core.js
step5_tco.js: utils.js reader.js printer.js env.js core.js
step6_file.js: utils.js reader.js printer.js env.js core.js
step7_quote.js: utils.js reader.js printer.js env.js core.js
step8_macros.js: utils.js reader.js printer.js env.js core.js
step9_try.js: utils.js reader.js printer.js env.js core.js
stepA_mal.js: utils.js reader.js printer.js env.js core.js

clean:
rm -f $(BINS)

stats: $(SOURCES)
@wc $^
@printf "%5s %5s %5s %s\n" `egrep "^\w*#|^\w*$$" $^ | wc` "[comments/blanks]"

stats-lisp: $(SOURCES_LISP)
@wc $^
@printf "%5s %5s %5s %s\n" `egrep "^\w*#|^\w*$$" $^ | wc` "[comments/blanks]"
Loading

0 comments on commit ebe3ff5

Please sign in to comment.