I added Garbage Collection to Lox, I used Mark and Sweep algorithm to mark all roots and trace all references in the compiler, free objects are swept away for memory reuse. So you don't have to worry about memory management, you can add variables.
I also added Object Oriented Progamming in Lox, it has classes, intances, constructors, supercalls, inherited methods and fields:
You can define classes within functions and methods with its own methods:
This is the disassembler of the code above, I optimized the calls to methods via super-intructions, these instructions basically make the function of two instructions in once:
If you want to look at the code:
No comments:
Post a Comment