1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 18:18:51 +03:00
mal/es6/step0_repl.js

20 lines
334 B
JavaScript
Raw Normal View History

import { readline } from './node_readline'
2015-07-31 05:15:55 +03:00
// read
const READ = (str) => str
2015-07-31 05:15:55 +03:00
// eval
const EVAL = (ast, env) => ast
2015-07-31 05:15:55 +03:00
// print
const PRINT = (exp) => exp
2015-07-31 05:15:55 +03:00
// repl
const REP = (str) => PRINT(EVAL(READ(str), {}))
2015-07-31 05:15:55 +03:00
while (true) {
let line = readline('user> ')
if (line == null) break
2015-07-31 05:15:55 +03:00
if (line) { console.log(REP(line)); }
}