blob: 7b03dd38cf7ef873e1ff1685f91fb6a7254dd64e (
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
|
source("readline.r")
READ <- function(str) {
return(str)
}
EVAL <- function(ast, env) {
return(ast)
}
PRINT <- function(exp) {
return(exp)
}
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: ", err$message,"\n", sep="")
})
}
|