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.
This commit is contained in:
@@ -5,3 +5,4 @@ class Foo { // line comment
|
||||
}
|
||||
var a = Foo.new
|
||||
a.bar
|
||||
"a string"
|
||||
|
||||
Reference in New Issue
Block a user