implementing garbage collection (ch26)

This commit is contained in:
2024-08-30 09:53:32 +02:00
parent 96e8b1742c
commit 265a0221e8
12 changed files with 403 additions and 39 deletions

21
samples/ch26_gc.lox Normal file
View File

@@ -0,0 +1,21 @@
fun do_stuff(v) {
var s = v + v;
print s;
}
fun blah() {
var c = "ha" + "ha";
for(var i = 0; i < 100; i = i + 1) {
var d = "ha" + num2str(i);
do_stuff(d);
}
return "hiii";
}
var a = blah();
a = "updated";
// GC here.
print a;