import std.stdio; import std.string; import parser; import dbg; import chunk; import compiler; import vm; /* import compiler; import obj; import dbg; import chunk; import vm; */ void repl() { while(true) { write("> "); string input = strip(stdin.readln()); if (input.length == 0) { continue; } Parser parser = new Parser(input); /* Chunk chunk = new Chunk(); Form f; while (true) { f = parser.parseForm(); printForm(f, ""); f.compile(chunk); if (f.type == FormType.EOF) { break; } } */ Compiler compiler = new Compiler(FunctionType.SCRIPT, &parser); Function func = compiler.compile(); VM vm = new VM(func); vm.run(); /* writeln("== disassembling chunk =="); int off = 0; while (off < func.chunk.code.length) { off = disassemble(func.chunk, off); } */ /* Compiler compiler = new Compiler(lex); ObjFunction func = compiler.compile(); VM vm = new VM(func); vm.run(); */ } } void main() { repl(); }