This website requires JavaScript.
Retoor software development
Projects
Research
SearchXNG
Register
Sign In
9 lines
83 B
Plaintext
Raw
Normal View
History
Unescape
Escape
feat: add line comment support to lexer with skipLineComment helper Add a new `skipLineComment` function to the compiler's lexer that consumes characters from the current position until a newline or end-of-file is encountered. Update the `readRawToken` switch case for '/' to detect the "//" sequence and delegate to the new function instead of emitting a TOKEN_SLASH. Also add a line comment to the example hello.wren file to demonstrate the feature.
2013-10-26 05:07:04 +02:00
class Foo { // line comment
feat: implement class method definition and instance creation in compiler and VM Add method parsing and compilation in `statement()` for class bodies, including symbol interning and block constant emission. Introduce `addConstant()` helper in compiler.c. Extend VM with `CODE_METHOD` opcode, `ObjInstance` type, `makeInstance()` factory, metaclass support in `makeClass()`, and `getSymbolName()` for symbol table lookup. Update vm.h with new type enum, struct definitions, and function declarations.
2013-10-25 06:32:17 +02:00
bar {
123
}
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
}
feat: implement class method definition and instance creation in compiler and VM Add method parsing and compilation in `statement()` for class bodies, including symbol interning and block constant emission. Introduce `addConstant()` helper in compiler.c. Extend VM with `CODE_METHOD` opcode, `ObjInstance` type, `makeInstance()` factory, metaclass support in `makeClass()`, and `getSymbolName()` for symbol table lookup. Update vm.h with new type enum, struct definitions, and function declarations.
2013-10-25 06:32:17 +02:00
var a = Foo.new
a.bar
feat: add string literal parsing and runtime string object support Add a new string() compiler function to handle string literal tokens by stripping surrounding quotes, allocating a heap copy, and emitting a constant load instruction. Introduce the OBJ_STRING object type with ObjString struct and makeString() factory, wire it into the VM's class dispatch for string receivers, and implement printValue output for string values. Extend the VM state with a stringClass field and update the hello.wren example to include a string literal.
2013-10-26 05:40:24 +02:00
"a string"
Reference in New Issue
Copy Permalink
f9988ff626
wren
/
example
/
hello.wren