mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 21:57:38 +03:00
miniMAL: update to miniMAL-1.2.2
- Update to ubuntu 24.04 Dockerfile and add labels. - update to working version of ffi-napi - Remove from miniMAL-core.json the things that overlap with the builtin core functionality that miniMAL now provides in 1.2.2. - Update ARGS variable to argv to align with how 1.2.2 now does command line parameters.
This commit is contained in:
parent
e6ec37a468
commit
6bf89ea118
@ -1,5 +1,7 @@
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:24.04
|
||||
MAINTAINER Joel Martin <github@martintribe.org>
|
||||
LABEL org.opencontainers.image.source=https://github.com/kanaka/mal
|
||||
LABEL org.opencontainers.image.description="mal test container: miniMAL"
|
||||
|
||||
##########################################################
|
||||
# General requirements for testing or common across many
|
||||
@ -9,7 +11,8 @@ MAINTAINER Joel Martin <github@martintribe.org>
|
||||
RUN apt-get -y update
|
||||
|
||||
# Required for running tests
|
||||
RUN apt-get -y install make python
|
||||
RUN apt-get -y install make python3
|
||||
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# Some typical implementation and test requirements
|
||||
RUN apt-get -y install curl libreadline-dev libedit-dev
|
||||
@ -24,14 +27,9 @@ WORKDIR /mal
|
||||
# For building node modules
|
||||
RUN apt-get -y install g++
|
||||
|
||||
# Add nodesource apt repo config for 10.x stable
|
||||
RUN apt-get -y install gnupg
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
|
||||
|
||||
# Install nodejs
|
||||
RUN apt-get -y install nodejs
|
||||
RUN apt-get -y install nodejs npm
|
||||
|
||||
ENV NPM_CONFIG_CACHE /mal/.npm
|
||||
|
||||
# install miniMAL
|
||||
RUN npm install -g minimal-lisp
|
||||
RUN npm install -g minimal-lisp@1.2.2
|
||||
|
@ -10,6 +10,12 @@
|
||||
["and", ["string?", "s"],
|
||||
["not", ["=", ["`", "\u029e"], ["get", "s", 0]]]]]],
|
||||
|
||||
["def", "_function?", ["fn", ["a"],
|
||||
["isa", "a", "Function"]]],
|
||||
|
||||
["def", "_number?", ["fn", ["a"],
|
||||
["=", ["`", "[object Number]"], ["classOf", "a"]]]],
|
||||
|
||||
["def", "div", ["fn", ["a", "b"], ["parseInt", ["/", "a", "b"]]]],
|
||||
|
||||
["def", "time-ms", ["fn", [],
|
||||
@ -121,9 +127,9 @@
|
||||
["`", "symbol?"], "symbol?",
|
||||
["`", "keyword"], "keyword",
|
||||
["`", "keyword?"], "keyword?",
|
||||
["`", "number?"], "number?",
|
||||
["`", "number?"], "_number?",
|
||||
["`", "fn?"], ["fn", ["a"],
|
||||
["or", ["function?", "a"],
|
||||
["or", ["_function?", "a"],
|
||||
["and", ["malfunc?", "a"],
|
||||
["not", ["get", "a", ["`", "macro?"]]]]]],
|
||||
["`", "macro?"], ["fn", ["a"],
|
||||
|
@ -1,124 +1,5 @@
|
||||
["do",
|
||||
|
||||
["def", "new", ["fn", ["a", "&", "b"],
|
||||
[".", "Reflect", ["`", "construct"], "a", "b"]]],
|
||||
["def", "del", ["fn", ["a", "b"],
|
||||
[".", "Reflect", ["`", "deleteProperty"], "a", "b"]]],
|
||||
["def", "map", ["fn", ["a", "b"],
|
||||
[".", "b", ["`", "map"], ["fn", ["x"], ["a", "x"]]]]],
|
||||
["def", "list", ["fn", ["&", "a"], "a"]],
|
||||
["def", ">=", ["fn", ["a", "b"],
|
||||
["if", ["<", "a", "b"], false, true]]],
|
||||
["def", ">", ["fn", ["a", "b"],
|
||||
["if", [">=", "a", "b"],
|
||||
["if", ["=", "a", "b"], false, true],
|
||||
false]]],
|
||||
["def", "<=", ["fn", ["a", "b"],
|
||||
["if", [">", "a", "b"], false, true]]],
|
||||
|
||||
["def", "classOf", ["fn", ["a"],
|
||||
[".", [".-", [".-", "Object", ["`", "prototype"]], ["`", "toString"]],
|
||||
["`", "call"], "a"]]],
|
||||
|
||||
["def", "not", ["fn", ["a"], ["if", "a", false, true]]],
|
||||
|
||||
["def", "null?", ["fn", ["a"], ["=", null, "a"]]],
|
||||
["def", "true?", ["fn", ["a"], ["=", true, "a"]]],
|
||||
["def", "false?", ["fn", ["a"], ["=", false, "a"]]],
|
||||
["def", "string?", ["fn", ["a"],
|
||||
["if", ["=", "a", null],
|
||||
false,
|
||||
["=", ["`", "String"],
|
||||
[".-", [".-", "a", ["`", "constructor"]],
|
||||
["`", "name"]]]]]],
|
||||
["def", "number?", ["fn", ["a"],
|
||||
["=", ["`", "[object Number]"], ["classOf", "a"]]]],
|
||||
["def", "function?", ["fn", ["a"],
|
||||
["isa", "a", "Function"]]],
|
||||
|
||||
["def", "pr-list*", ["fn", ["a", "b", "c"],
|
||||
[".", ["map", ["fn", ["x"],
|
||||
["if", "c",
|
||||
[".", "JSON", ["`", "stringify"], "x"],
|
||||
["if", ["string?", "x"],
|
||||
"x",
|
||||
[".", "JSON", ["`", "stringify"], "x"]]]],
|
||||
"a"],
|
||||
["`", "join"], "b"]]],
|
||||
["def", "pr-str", ["fn", ["&", "a"],
|
||||
["pr-list*", "a", ["`", " "], true]]],
|
||||
["def", "str", ["fn", ["&", "a"],
|
||||
["pr-list*", "a", ["`", ""], false]]],
|
||||
["def", "prn", ["fn", ["&", "a"],
|
||||
["do", [".", "console", ["`", "log"],
|
||||
["pr-list*", "a", ["`", " "], true]], null]]],
|
||||
["def", "println", ["fn", ["&", "a"],
|
||||
["do", [".", "console", ["`", "log"],
|
||||
["pr-list*", "a", ["`", " "], false]], null]]],
|
||||
|
||||
["def", "list?", ["fn", ["a"],
|
||||
[".", "Array", ["`", "isArray"], "a"]]],
|
||||
["def", "contains?", ["fn", ["a", "b"],
|
||||
[".", "a", ["`", "hasOwnProperty"], "b"]]],
|
||||
["def", "get", ["fn", ["a", "b"],
|
||||
["if", ["contains?", "a", "b"], [".-", "a", "b"], null]]],
|
||||
["def", "set", ["fn", ["a", "b", "c"],
|
||||
["do", [".-", "a", "b", "c"], "a"]]],
|
||||
["def", "keys", ["fn", ["a"],
|
||||
[".", "Object", ["`", "keys"], "a"]]],
|
||||
["def", "vals", ["fn", ["a"],
|
||||
["map",["fn", ["k"], ["get", "a", "k"]], ["keys", "a"]]]],
|
||||
|
||||
["def", "cons", ["fn", ["a", "b"],
|
||||
[".", ["`", []],
|
||||
["`", "concat"], ["list", "a"], "b"]]],
|
||||
["def", "concat", ["fn", ["&", "a"],
|
||||
[".", [".-", ["list"], ["`", "concat"]],
|
||||
["`", "apply"], ["list"], "a"]]],
|
||||
["def", "nth", "get"],
|
||||
["def", "first", ["fn", ["a"],
|
||||
["if", [">", [".-", "a", ["`", "length"]], 0],
|
||||
["nth", "a", 0],
|
||||
null]]],
|
||||
["def", "last", ["fn", ["a"],
|
||||
["nth", "a", ["-", [".-", "a", ["`", "length"]], 1]]]],
|
||||
["def", "count", ["fn", ["a"],
|
||||
[".-", "a", ["`", "length"]]]],
|
||||
["def", "empty?", ["fn", ["a"],
|
||||
["if", ["list?", "a"],
|
||||
["if", ["=", 0, [".-", "a", ["`", "length"]]], true, false],
|
||||
["=", "a", null]]]],
|
||||
["def", "slice", ["fn", ["a", "b", "&", "end"],
|
||||
[".", "a", ["`", "slice"], "b",
|
||||
["if", [">", ["count", "end"], 0],
|
||||
["get", "end", 0],
|
||||
[".-", "a", ["`", "length"]]]]]],
|
||||
["def", "rest", ["fn", ["a"], ["slice", "a", 1]]],
|
||||
|
||||
["def", "apply", ["fn", ["f", "&", "b"],
|
||||
[".", "f", ["`", "apply"], "f",
|
||||
["concat", ["slice", "b", 0, -1], ["last", "b"]]]]],
|
||||
|
||||
["def", "and", ["~", ["fn", ["&", "xs"],
|
||||
["if", ["empty?", "xs"],
|
||||
true,
|
||||
["if", ["=", 1, ["count", "xs"]],
|
||||
["first", "xs"],
|
||||
["list", ["`", "let"], ["list", ["`", "and_FIXME"], ["first", "xs"]],
|
||||
["list", ["`", "if"], ["`", "and_FIXME"],
|
||||
["concat", ["`", ["and"]], ["rest", "xs"]],
|
||||
["`", "and_FIXME"]]]]]]]],
|
||||
|
||||
["def", "or", ["~", ["fn", ["&", "xs"],
|
||||
["if", ["empty?", "xs"],
|
||||
null,
|
||||
["if", ["=", 1, ["count", "xs"]],
|
||||
["first", "xs"],
|
||||
["list", ["`", "let"], ["list", ["`", "or_FIXME"], ["first", "xs"]],
|
||||
["list", ["`", "if"], ["`", "or_FIXME"],
|
||||
["`", "or_FIXME"],
|
||||
["concat", ["`", ["or"]], ["rest", "xs"]]]]]]]]],
|
||||
|
||||
["def", "repl", ["fn",["prompt", "rep"],
|
||||
["let", ["readline", ["require", ["`", "readline"]],
|
||||
"opts", ["new", "Object"],
|
||||
|
@ -4,6 +4,6 @@
|
||||
"description": "Make a Lisp (mal) language implemented in miniMAL",
|
||||
"dependencies": {
|
||||
"minimal-lisp": "1.0.2",
|
||||
"ffi-napi": "2.4.x"
|
||||
"ffi-napi": "4.0.3"
|
||||
}
|
||||
}
|
||||
|
@ -97,14 +97,14 @@
|
||||
["env-set", "repl-env", ["symbol", ["`", "eval"]],
|
||||
["fn", ["ast"], ["EVAL", "ast", "repl-env"]]],
|
||||
["env-set", "repl-env", ["symbol", ["`", "*ARGV*"]],
|
||||
["slice", "ARGS", 1]],
|
||||
["slice", "argv", 1]],
|
||||
|
||||
["`", "core.mal: defined using mal itself"],
|
||||
["rep", ["`", "(def! not (fn* (a) (if a false true)))"]],
|
||||
["rep", ["`", "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))"]],
|
||||
|
||||
["if", ["not", ["empty?", "ARGS"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "ARGS", 0], ["`", "\")"]]],
|
||||
["if", ["not", ["empty?", "argv"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "argv", 0], ["`", "\")"]]],
|
||||
["repl", ["`", "user> "], "rep"]],
|
||||
|
||||
null
|
||||
|
@ -130,14 +130,14 @@
|
||||
["env-set", "repl-env", ["symbol", ["`", "eval"]],
|
||||
["fn", ["ast"], ["EVAL", "ast", "repl-env"]]],
|
||||
["env-set", "repl-env", ["symbol", ["`", "*ARGV*"]],
|
||||
["slice", "ARGS", 1]],
|
||||
["slice", "argv", 1]],
|
||||
|
||||
["`", "core.mal: defined using mal itself"],
|
||||
["rep", ["`", "(def! not (fn* (a) (if a false true)))"]],
|
||||
["rep", ["`", "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))"]],
|
||||
|
||||
["if", ["not", ["empty?", "ARGS"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "ARGS", 0], ["`", "\")"]]],
|
||||
["if", ["not", ["empty?", "argv"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "argv", 0], ["`", "\")"]]],
|
||||
["repl", ["`", "user> "], "rep"]],
|
||||
|
||||
null
|
||||
|
@ -154,15 +154,15 @@
|
||||
["env-set", "repl-env", ["symbol", ["`", "eval"]],
|
||||
["fn", ["ast"], ["EVAL", "ast", "repl-env"]]],
|
||||
["env-set", "repl-env", ["symbol", ["`", "*ARGV*"]],
|
||||
["slice", "ARGS", 1]],
|
||||
["slice", "argv", 1]],
|
||||
|
||||
["`", "core.mal: defined using mal itself"],
|
||||
["rep", ["`", "(def! not (fn* (a) (if a false true)))"]],
|
||||
["rep", ["`", "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))"]],
|
||||
["rep", ["`", "(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))"]],
|
||||
|
||||
["if", ["not", ["empty?", "ARGS"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "ARGS", 0], ["`", "\")"]]],
|
||||
["if", ["not", ["empty?", "argv"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "argv", 0], ["`", "\")"]]],
|
||||
["repl", ["`", "user> "], "rep"]],
|
||||
|
||||
null
|
||||
|
@ -167,15 +167,15 @@
|
||||
["env-set", "repl-env", ["symbol", ["`", "eval"]],
|
||||
["fn", ["ast"], ["EVAL", "ast", "repl-env"]]],
|
||||
["env-set", "repl-env", ["symbol", ["`", "*ARGV*"]],
|
||||
["slice", "ARGS", 1]],
|
||||
["slice", "argv", 1]],
|
||||
|
||||
["`", "core.mal: defined using mal itself"],
|
||||
["rep", ["`", "(def! not (fn* (a) (if a false true)))"]],
|
||||
["rep", ["`", "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))"]],
|
||||
["rep", ["`", "(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))"]],
|
||||
|
||||
["if", ["not", ["empty?", "ARGS"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "ARGS", 0], ["`", "\")"]]],
|
||||
["if", ["not", ["empty?", "argv"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "argv", 0], ["`", "\")"]]],
|
||||
["repl", ["`", "user> "], "rep"]],
|
||||
|
||||
null
|
||||
|
@ -167,7 +167,7 @@
|
||||
["env-set", "repl-env", ["symbol", ["`", "eval"]],
|
||||
["fn", ["ast"], ["EVAL", "ast", "repl-env"]]],
|
||||
["env-set", "repl-env", ["symbol", ["`", "*ARGV*"]],
|
||||
["slice", "ARGS", 1]],
|
||||
["slice", "argv", 1]],
|
||||
|
||||
["`", "core.mal: defined using mal itself"],
|
||||
["rep", ["`", "(def! *host-language* \"miniMAL\")"]],
|
||||
@ -175,8 +175,8 @@
|
||||
["rep", ["`", "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))"]],
|
||||
["rep", ["`", "(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))"]],
|
||||
|
||||
["if", ["not", ["empty?", "ARGS"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "ARGS", 0], ["`", "\")"]]],
|
||||
["if", ["not", ["empty?", "argv"]],
|
||||
["rep", ["str", ["`", "(load-file \""], ["get", "argv", 0], ["`", "\")"]]],
|
||||
["do",
|
||||
["rep", ["`", "(println (str \"Mal [\" *host-language* \"]\"))"]],
|
||||
["repl", ["`", "user> "], "rep"]]],
|
||||
|
Loading…
Reference in New Issue
Block a user