blob: 678bfb05d757d741e3e6771fb02c6c82445aebc2 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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);
Compiler compiler = new Compiler(FunctionType.SCRIPT, &parser);
Function func = compiler.compile();
VM vm = new VM(func);
vm.run();
}
}
void main() {
repl();
}
|