Differences From Artifact [981f3ba98be4374d]:
- File
main.d
- 2010-11-11 15:22:55 - part of checkin [6f0ec5b7c9] on branch trunk - Custom Test Runner (user: kinaba) [annotate]
To Artifact [b6f89f38f0a1626d]:
- File
main.d
- 2010-11-13 12:16:47 - part of checkin [5afe8e3f26] on branch trunk - Memoization on non "@v" layer. Now simplest metalevel computation works!! Also, added -l option. (user: kinaba) [annotate]
18 18 {
19 19 Table ctx;
20 20 string buf;
21 21 Value lastVal;
22 22 int lineno = 1;
23 23 int nextlineno = 1;
24 24 this() { ctx = createGlobalContext(); }
25 + this(string filename) {
26 + ctx = createGlobalContext();
27 + eval(parseFile(filename), ctx, false, "@v");
28 + }
25 29
26 30 bool tryRun( string s )
27 31 {
28 32 scope(failure)
29 33 { buf = ""; lineno = nextlineno; }
30 34
31 35 buf ~= s;
................................................................................
52 56 writeln(e);
53 57 }
54 58 return true;
55 59 }
56 60 }
57 61
58 62 /// Entry point. If args.length==1, invoke REPL.
63 +/// If args.length==3 && args[1]=="-l" read args[2] and invoke REPL.
59 64 /// Otherwise interpret the argument as a filename.
60 65 void main( string[] args )
61 66 {
62 67 if( args.length <= 1 )
63 68 {
64 69 writeln("Welcome to Polemy 0.1.0");
65 70 for(auto r = new REPL; r.singleInteraction();) {}
66 71 }
72 + else if( args.length>=3 && args[1]=="-l" )
73 + {
74 + writeln("Welcome to Polemy 0.1.0");
75 + for(auto r = new REPL(args[2]); r.singleInteraction();) {}
76 + }
67 77 else
68 78 {
69 79 evalFile(args[1]);
70 80 }
71 81 }