Added livescript
authorJos van Bakel <josvanbakel@gmail.com>
Wed, 5 Apr 2017 20:01:41 +0000 (22:01 +0200)
committerJos van Bakel <josvanbakel@gmail.com>
Wed, 5 Apr 2017 20:01:41 +0000 (22:01 +0200)
.gitignore
Makefile
livescript/Makefile [new file with mode: 0644]
livescript/package.json [new file with mode: 0644]
livescript/run [new file with mode: 0755]
livescript/step0_repl.ls [new file with mode: 0644]

index c7d90d9..a7f1a11 100644 (file)
@@ -124,3 +124,4 @@ common-lisp/*.fasl
 common-lisp/*.lib
 common-lisp/images/*
 common-lisp/hist/*
+livescript/*.js
index ab2b4fd..1ad8c84 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
 
@@ -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
diff --git a/livescript/Makefile b/livescript/Makefile
new file mode 100644 (file)
index 0000000..cc5e7a8
--- /dev/null
@@ -0,0 +1,16 @@
+TESTS =
+
+SOURCES_BASE = 
+SOURCES_LISP = stepA_mal.ls
+SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
+
+all: node_modules
+
+node_modules:
+       npm install
+
+%.js: %.ls
+       lsc -d -c $(@:%.js=%.ls)
+
+clean:
+       rm -f *.js
diff --git a/livescript/package.json b/livescript/package.json
new file mode 100644 (file)
index 0000000..e4325a1
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "name": "livescript",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "dependencies": {
+    "prelude-ls": "^1.1.2"
+  },
+  "devDependencies": {},
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC"
+}
diff --git a/livescript/run b/livescript/run
new file mode 100755 (executable)
index 0000000..6605303
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec node $(dirname $0)/${STEP:-stepA_mal}.js "${@}"
diff --git a/livescript/step0_repl.ls b/livescript/step0_repl.ls
new file mode 100644 (file)
index 0000000..b57aa61
--- /dev/null
@@ -0,0 +1,23 @@
+readline = require 'readline'
+{id} = require 'prelude-ls'
+
+
+READ = id
+EVAL = ->
+PRINT = id
+rep = (line) ->
+
+
+rl = readline.createInterface do
+    input : process.stdin
+    output : process.stdout
+    prompt: 'user> '
+
+rl.on 'line', (line) ->
+    console.log rep line
+    rl.prompt!
+
+rl.on 'close', ->
+    process.exit 0
+
+rl.prompt!