(env/env-set repl-env '*ARGV* ())
;; core.mal: defined using the language itself
-(rep "(def! *host-language* \"clojure\")")
(rep "(def! not (fn* [a] (if a false true)))")
(rep "(def! load-file (fn* [f] (eval (read-string (str \"(do \" (slurp f) \")\")))))")
(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 args
(rep (str "(load-file \"" (first args) "\")"))
(do
- (rep "(println (str \"Mal [\" *host-language* \"]\"))")
(repl-loop))))
All:
- - add license file
- - add re (with rep) and use that (to avoid printing)
- - keyword type (with hash-map key support)
- - remove conj and sequential? as necessary elements
+ * keyword type (with hash-map key support)
+ - change perf test to run for 10 seconds and then calculate number
+ of iterations per second
- redefine (defmacro!) as (def! (macro*))
+ - runtest expect fixes:
+ - stop using expect, so we can drop --raw option
+ - fix long lines in runtext/expect
+ - add license file
+ - add re (use in rep) everywhere and use that (to avoid printing)
+ - move conj and sequential? to core.mal
- Move *host-language* from step9 to stepA
- Implement/fix interop: C#, Java, Mal, PHP, Postscript, Ruby
- - fix long lines in runtext/expect
- regular expression matching in runtest
- Print full exception when test gets EOF from expect
+ - protocols!
+ - https://github.com/pixie-lang/pixie
+
- Break out impl eval into step0.5
- Fix quasiquoting of vectors
- GC
C#:
+ - fix command line arg processing (doesn't run file specified)
Clojure:
+ - make indent consistent across steps (e.g. step5, step8)
CoffeeScript:
- make target to compile to JS
https://gobyexample.com/variadic-functions
Haskell:
+ - TCO using seq/bang patterns:
+ http://stackoverflow.com/questions/9149183/tail-optimization-guarantee-loop-encoding-in-haskell
Java:
- Use gradle instead of mvn
- interop: callbacks using Mal functions
Make:
+ - large number handling (move away from peano)
+ - then fix time-ms/perf.mal
- allow '_' in make variable names
- Fix: make -f stepA_interop.mk ../mal/step6_file.mal
(slurp "../tests/incA.mal")
Postscript:
- add negative numbers
+ - fix blank line after comments
Python:
- error: python ../python/stepA_interop.py ../mal/stepA_interop.mal ../mal/stepA_interop.mal
- interop tests
R:
+ - Links:
+ - https://stat.ethz.ch/R-manual/R-devel/library/base/html/readline.html
+ - http://dssm.unipa.it/CRAN/web/packages/rdyncall/rdyncall.pdf
+ - http://www.dyncall.org/docs/FFI.pdf
- tracebacks in errors
+ - fix running from different directory
Ruby:
Rust:
- - use built-in regex once fixed:
- https://github.com/rust-lang/rust/issues/18034
- https://github.com/rust-lang/rust/issues/18035
-
-VB.Net
- - convert readline.cs to readline.vb
-
-
----------------------------------------------
-
-
-Future Implementations:
-
- * Rust:
+ - Links:
- http://doc.rust-lang.org/index.html
- http://doc.rust-lang.org/intro.html
- http://doc.rust-lang.org/guide.html
- https://github.com/shaleh/rust-readline/blob/master/src/lib.rs
- http://stackoverflow.com/questions/23942627/does-rust-0-10-have-a-rl-package
- http://blog.skylight.io/rust-means-never-having-to-close-a-socket/
- * R
- - https://stat.ethz.ch/R-manual/R-devel/library/base/html/readline.html
- - http://dssm.unipa.it/CRAN/web/packages/rdyncall/rdyncall.pdf
- - http://www.dyncall.org/docs/FFI.pdf
+ - use built-in regex once fixed:
+ https://github.com/rust-lang/rust/issues/18034
+ https://github.com/rust-lang/rust/issues/18035
+
+Racket
+ - metadata on collections
+
+Scala
+ - aptitude install scala
+ - http://learnxinyminutes.com/docs/scala/
+ - readline
+
+VB.Net
+ - aptitude install mono-vbnc
+ - http://www.codeproject.com/Articles/9978/Complete-Comparison-for-VB-NET-and-C
+ - http://msdn.microsoft.com/en-us/library/8hb2a397.aspx
+ - convert readline.cs to readline.vb
+
+
+---------------------------------------------
+
+
+Future Implementations:
+
+ - Ada (gnat)
+ - http://rosettacode.org/wiki/Regular_expressions#Ada
+
+ - C++
- Groovy
- http://groovy-lang.org/learn.html
- http://groovy-lang.org/structure.html
- - Scala
- - aptitude install scala
- - http://learnxinyminutes.com/docs/scala/
+ - Erlang
+
+ - F#
- - Visual Basic
- aptitude install mono-vbnc
+ - Haxe
+ - http://api.haxe.org/
+ - http://haxe.us/haxe_tutorial.html
+
+ - Lua
+
+ - Objective-C:
+
+ - Pascal:
+ sudo aptitude install fp-compiler-2.6.2
- VimL
- https://github.com/tpope/timl
+ - Tcl
+
- TeX/LaTeX
- Basic interpreter in TeX: http://ctanhg.scharrer-online.de/pkg/basix.html
- Cheat Sheet: http://www.stdout.org/~winston/latex/latexsheet.pd
- latex '\nonstopmode\input' blah.tex
-
- - VB.Net
- http://www.codeproject.com/Articles/9978/Complete-Comparison-for-VB-NET-and-C
- http://msdn.microsoft.com/en-us/library/8hb2a397.aspx
- add nth, first, and rest to core.ns
- make test^go^step8 should now pass
-- stepA_try
+- step9_try
- core module:
- throw function
- apply, map functions: should not directly call EVAL, which
---- step9_try -----------------------------------
+--- stepA_interop -------------------------------
import types, reader, printer, env, core
READ(str): return reader.read_str(str)
---- step9_try -----------------------------------
+--- stepA_interop -------------------------------
import types, reader, printer, env, core
READ(str): return reader.read_str(str)
REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv))
# core.mal: defined in terms of the language itself
-$(call do,$(call REP, (def! *host-language* "make") ))
$(call do,$(call REP, (def! not (fn* (a) (if a false true))) ))
$(call do,$(call REP, (def! load-file (fn* (f) (eval (read-string (str "(do " (slurp f) ")"))))) ))
$(call do,$(call 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))))))) ))
$(eval INTERACTIVE :=),)
# repl loop
-$(if $(strip $(INTERACTIVE)),\
- $(call do,$(call REP, (println (str "Mal [" *host-language* "]")) )) \
- $(call REPL))
+$(if $(strip $(INTERACTIVE)),$(call REPL))
.PHONY: none $(MAKECMDGOALS)
none $(MAKECMDGOALS):
(env-set repl-env '*ARGV* (rest *ARGV*))
;; core.mal: defined using the new language itself
-(rep (str "(def! *host-language* \"" *host-language* "-mal\")"))
(rep "(def! not (fn* [a] (if a false true)))")
(rep "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))")
(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)))))))")
(def! -main (fn* [& args]
(if (> (count args) 0)
(rep (str "(load-file \"" (first args) "\")"))
- (do
- (rep "(println (str \"Mal [\" *host-language* \"]\"))")
- (repl-loop)))))
+ (repl-loop))))
(apply -main *ARGV*)
(*ARGV*) [ ] _list_from_array _ref
% core.mal: defined using the language itself
-(\(def! *host-language* "postscript"\)) RE pop
(\(def! not \(fn* \(a\) \(if a false true\)\)\)) RE pop
(\(def! load-file \(fn* \(f\) \(eval \(read-string \(str "\(do " \(slurp f\) "\)"\)\)\)\)\)) RE pop
(\(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\)\)\)\)\)\)\)) RE pop
} if
% repl loop
-(\(println \(str "Mal [" *host-language* "]"\)\)) RE pop
{ %loop
(user> ) _readline
not { exit } if % exit if EOF
{
token not { exit } if
exch
+ count stackcnt sub 1 roll % send leftover string to bottom
+ exec
+ count stackcnt sub -1 roll % bring leftover string to top
} loop
- exec
count stackcnt gt { % if new operands on stack
% return an list of new operands
count stackcnt sub array astore
Env.set(repl_env, "*ARGV*", new.list())
# core.mal: defined using the language itself
-. <- rep("(def! *host-language* \"R\")")
. <- rep("(def! not (fn* (a) (if a false true)))")
. <- rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))")
. <- 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)))))))")
quit(save="no", status=0)
}
-. <- rep("(println (str \"Mal [\" *host-language* \"]\"))")
repeat {
line <- readline("user> ")
if (is.null(line)) { cat("\n"); break }
return case token
when /^-?[0-9]+$/ then token.to_i # integer
when /^-?[0-9][0-9.]*$/ then token.to_f # float
- when /^"/ then parse_str(token) # string
+ when /^".*"$/ then parse_str(token) # string
when /^:/ then "\u029e" + token[1..-1] # keyword
when "nil" then nil
when "true" then true
end
def read_form(rdr)
- token = rdr.peek
return case rdr.peek
when ";" then nil
when "'" then rdr.next; List.new [:quote, read_form(rdr)]
repl_env.set(:"*ARGV*", List.new(ARGV.slice(1,ARGV.length) || []))
# core.mal: defined using the language itself
-RE["(def! *host-language* \"ruby\")"]
RE["(def! not (fn* (a) (if a false true)))"]
RE["(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"]
RE["(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)))))))"]
end
# repl loop
-RE["(println (str \"Mal [\" *host-language* \"]\"))"]
while line = _readline("user> ")
begin
puts REP[line]