1 import rl from './node_readline.js'
2 const readline = rl.readline
3 import { BlankException, read_str } from './reader'
4 import { pr_str } from './printer'
7 const READ = str => read_str(str)
10 const EVAL = (ast, env) => ast
13 const PRINT = exp => pr_str(exp, true)
16 const REP = str => PRINT(EVAL(READ(str), {}))
19 let line = readline('user> ')
20 if (line == null) break
22 if (line) { console.log(REP(line)) }
24 if (exc instanceof BlankException) { continue }
25 if (exc instanceof Error) { console.warn(exc.stack) }
26 else { console.warn(`Error: ${exc}`) }