implementing garbage collection (ch26)

This commit is contained in:
2024-08-30 09:53:32 +02:00
parent 96e8b1742c
commit 2e6f977b34
13 changed files with 404 additions and 40 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;