feat: implement local variable declarations and symbol table in compiler and VM

Add support for local variable declarations with `var` keyword in the Wren compiler, including a symbol table for tracking locals within blocks. Introduce new bytecode instructions (CODE_POP, CODE_LOAD_LOCAL, CODE_STORE_LOCAL) and a call frame stack in the VM to manage local variable scopes during execution. Refactor the symbol table from a flat array to a proper SymbolTable struct with init/clear/add/ensure/find functions, and add a primitive method table for the num class with an `abs` method.
This commit is contained in:
Bob Nystrom
2013-10-23 22:32:59 +00:00
parent 71c4c330ca
commit ca8f9faf18
4 changed files with 293 additions and 54 deletions
+3 -2
View File
@@ -1,2 +1,3 @@
123.ok
123.yar
var a = 123
var b = 345
a