2017-09-20 06:44:41 +03:00
|
|
|
#!/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) {})))
|
|
|
|
|
2017-09-22 07:32:15 +03:00
|
|
|
(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])
|
Test uncaught throw, catchless try* . Fix 46 impls.
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*.
2018-12-03 22:20:44 +03:00
|
|
|
(except [e Exception]
|
2017-09-22 07:32:15 +03:00
|
|
|
(print (.join "" (apply traceback.format_exception
|
|
|
|
(.exc_info sys))))))))
|