munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.75k stars 1.03k forks source link

Access to the VM stack from initCompiler #994

Closed giann closed 3 years ago

giann commented 3 years ago

Over at https://github.com/munificent/craftinginterpreters/blob/997617efeff026edde9d6ba339ff432e27031eca/c/compiler.c#L312 initCompiler will use copyString which in turn will call allocateString which does stack manipulation on the global vm.

How is this ok at compile time?

giann commented 3 years ago

Reading more about it, it at least seems useful to populate at compile time the interned strings table.