37 fprintf(stderr,
"DEBUG INDEX_GET: container.type=%d idx.type=%d\n",
42 fprintf(stderr,
"INDEX_GET index must be int for array\n");
47 fprintf(stderr,
"Runtime error: index out of range\n");
55 fprintf(stderr,
"INDEX_GET key must be string for map\n");
66 fprintf(stderr,
"Runtime type error: INDEX_GET expects array or map (got container=%s, index=%s)\n",
int map_get_copy(const Value *vm, const char *key, Value *out)
Look up a key and copy the stored value into out.
Tagged union representing a Fun value.
Value make_nil(void)
Construct a nil Value.
void free_value(Value v)
Free dynamic storage owned by a Value.
int array_get_copy(const Value *v, int index, Value *out)
Copy an array element into out.
static Value pop_value(VM *vm)
Pop a Value from the VM operand stack.
static const char * value_type_name(ValueType t)
Get a human-readable name for a ValueType.
static void push_value(VM *vm, Value v)
Push a Value onto the VM operand stack.