mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 02:27:10 +03:00
dd7a4f55f3
Fixes made to: ada, c, chuck, clojure, coffee, common-lisp, cpp, crystal, d, dart, elm, erlang, es6, factor, fsharp, gnu-smalltalk, groovy, guile, haxe, hy, js, livescript, matlab, miniMAL, nasm, nim, objc, objpascal, ocaml, perl, perl6, php, plsql, ps, python, r, rpython, ruby, scheme, swift3, tcl, ts, vb, vimscript, wasm, yorick. Catchless try* test is an optional test. Not all implementations support catchless try* but a number were fixed so they at least don't crash on catchless try*.
31 lines
690 B
Hy
Executable File
31 lines
690 B
Hy
Executable File
#!/usr/bin/env hy
|
|
|
|
(import sys traceback)
|
|
(import [reader [read-str Blank]])
|
|
(import [printer [pr-str]])
|
|
|
|
(defn READ [str]
|
|
(read-str str))
|
|
|
|
(defn EVAL [ast env]
|
|
ast)
|
|
|
|
(defn PRINT [exp]
|
|
(pr-str exp True))
|
|
|
|
(defn REP [str]
|
|
(PRINT (EVAL (READ str) {})))
|
|
|
|
(defmain [&rest args]
|
|
;; indented to match later steps
|
|
(while True
|
|
(try
|
|
(do (setv line (raw_input "user> "))
|
|
(if (= "" line) (continue))
|
|
(print (REP line)))
|
|
(except [EOFError] (break))
|
|
(except [Blank])
|
|
(except [e Exception]
|
|
(print (.join "" (apply traceback.format_exception
|
|
(.exc_info sys))))))))
|