Retoor software development Projects Research SearchXNG
Register Sign In

7 lines
36 B
Plaintext
Raw Normal View History

feat: add ObjBlock type, block compilation, and newline skipping in parser Introduce a new ObjBlock object type with OBJ_BLOCK tag, replacing the placeholder OBJ_NUM in makeBlock(). Refactor the compiler to separate Parser and Compiler structs, adding skipNewlines and hasError fields to Parser and a parent pointer to Compiler for nested block support. Implement compileBlock() function that compiles a block up to a specified end token, and update callBlock() in the VM to push empty slots for local variables. Adjust token reading functions to accept Parser instead of Compiler, and remove the MAX_TOKEN enum entry.
2013-10-24 21:39:01 +02:00
{
123
}
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.
2013-10-24 00:32:59 +02:00
var a = 123
var b = 345
a
Reference in New Issue Copy Permalink
281c917a50
wren/example/hello.wren
Response time: 38ms
Mail Licenses API