blob: 39d189b0857454ab434942d9ad5698b5efaac19f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
if(!exists("..readline..")) source("readline.r")
if(!exists("..types..")) source("types.r")
if(!exists("..reader..")) source("reader.r")
if(!exists("..printer..")) source("printer.r")
READ <- function(str) {
return(read_str(str))
}
EVAL <- function(ast, env) {
return(ast)
}
PRINT <- function(exp) {
return(.pr_str(exp, TRUE))
}
rep <- function(str) {
return(PRINT(EVAL(READ(str), "")))
}
repeat {
line <- readline("user> ")
if (is.null(line)) { cat("\n"); break }
tryCatch({
cat(rep(line),"\n", sep="")
}, error=function(err) {
cat("Error: ", get_error(err),"\n", sep="")
})
# R debug/fatal with tracebacks:
#cat(rep(line),"\n", sep="")
}
|