aboutsummaryrefslogtreecommitdiff
path: root/scala/step0_repl.scala
diff options
context:
space:
mode:
Diffstat (limited to 'scala/step0_repl.scala')
-rw-r--r--scala/step0_repl.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/scala/step0_repl.scala b/scala/step0_repl.scala
new file mode 100644
index 0000000..5ec94fe
--- /dev/null
+++ b/scala/step0_repl.scala
@@ -0,0 +1,33 @@
+object step0_repl {
+ def READ(str: String): String = {
+ str
+ }
+
+ def EVAL(str: String, env: String): String = {
+ str
+ }
+
+ def PRINT(str: String): String = {
+ str
+ }
+
+ def REP(str: String): String = {
+ PRINT(EVAL(READ(str), ""))
+ }
+
+ def main(args: Array[String]) {
+ var line:String = null
+ while ({line = readLine("user> "); line != null}) {
+ try {
+ println(REP(line))
+ } catch {
+ case e : Exception => {
+ println("Error: " + e.getMessage)
+ println(" " + e.getStackTrace.mkString("\n "))
+ }
+ }
+ }
+ }
+}
+
+// vim: ts=2:sw=2