1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 01:57:09 +03:00
mal/ts/step0_repl.ts
2017-02-25 11:44:45 +09:00

36 lines
541 B
TypeScript

import { readline } from "./node_readline";
// READ
function read(str: string): any {
// TODO
return str;
}
// EVAL
function evalMal(ast: any, _env?: any): any {
// TODO
return ast;
}
// PRINT
function print(exp: any): string {
// TODO
return exp;
}
function rep(str: string): string {
// TODO
return print(evalMal(read(str)));
}
while (true) {
const line = readline("user> ");
if (line == null) {
break;
}
if (line === "") {
continue;
}
console.log(rep(line));
}