aboutsummaryrefslogtreecommitdiff
path: root/compiler.d
diff options
context:
space:
mode:
authorBen Winston2023-05-22 20:26:27 -0400
committerBen Winston2023-05-22 20:26:27 -0400
commitab6deb5eb1244f566c8a8b22022c68d50d5eb4d7 (patch)
tree58295e80efb472836e8c226f10e00ffd16468b68 /compiler.d
parentb7fba62e9f1f9f7a5a67fd64d4aed55646d1b58e (diff)
make the REPL actually remember things
Diffstat (limited to 'compiler.d')
-rw-r--r--compiler.d11
1 files changed, 0 insertions, 11 deletions
diff --git a/compiler.d b/compiler.d
index 76f6c04..4b7775e 100644
--- a/compiler.d
+++ b/compiler.d
@@ -50,12 +50,9 @@ class Compiler {
}
void compileAdd(Form[] args) {
- writeln("compiling add");
int line = args[0].line;
resolve(args[0]);
- writeln("resolved the first argument");
func.chunk.writeOp(OpCode.OP_TYPE_CHECK_NUMBER, line);
- writeln("wrote the typecheck op");
// (+ n) always returns n
if (args.length == 1) {
@@ -208,7 +205,6 @@ class Compiler {
}
void compileIf(Form form) {
- writeln("compiling if...");
If if_ = cast(If)form;
resolve(if_.cond);
@@ -281,9 +277,7 @@ class Compiler {
Block block = cast(Block)form;
beginScope();
foreach (Form inner; block.blockBody) {
- writeln("about to compile an inner form");
resolve(inner);
- writeln("finished compiling inner form");
}
endScope();
}
@@ -314,7 +308,6 @@ class Compiler {
}
void compileFunc(Form form) {
- writeln("compiling func");
Func f = cast(Func)form;
// name the function
@@ -335,8 +328,6 @@ class Compiler {
}
}
- writeln("got the arguments");
-
/*
// compile each inner Form
foreach (Form inner; f.funcBody) {
@@ -350,8 +341,6 @@ class Compiler {
b.blockBody = f.funcBody;
compiler.compileBlock(b);
- writeln("compiled the body");
-
// write the function as a Value
Function outFunc = compiler.finish();
func.chunk.writeOp(OpCode.OP_CONSTANT, f.line);