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:
Bob Nystrom
2013-10-26 03:40:24 +00:00
parent 66d07c4f55
commit f9988ff626
4 changed files with 58 additions and 0 deletions
+1
View File
@@ -5,3 +5,4 @@ class Foo { // line comment
}
var a = Foo.new
a.bar
"a string"