Skip to content

Commit 6c366bc

Browse files
authored
Fix VM structure by adding missing fields
Added missing fields for object management and string interning in VM structure.
1 parent 22c8a64 commit 6c366bc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/vm.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "chunk.h"
55
#include "value.h"
6-
#include "table.h" // Agar table.h nahi hai to isse hata dein, but usually chahiye hota hai
6+
#include "table.h"
77
#include "object.h"
88

99
#define STACK_MAX 256
@@ -13,9 +13,9 @@ typedef struct {
1313
uint8_t* ip;
1414
Value stack[STACK_MAX];
1515
Value* stackTop;
16-
Obj* objects; // <--- YE MISSING THA (Bahut Zaroori)
17-
// Table strings; // Future ke liye
18-
// Table globals; // Future ke liye
16+
Obj* objects; // <--- This was missing and causing errors in object.c
17+
Table strings; // Needed for string interning
18+
Table globals; // Needed for global variables
1919
} VM;
2020

2121
typedef enum {
@@ -29,12 +29,12 @@ extern VM vm;
2929

3030
void initVM();
3131
void freeVM();
32-
InterpretResult interpret(Chunk* chunk);
32+
InterpretResult interpret(const char* source); // Standard CLOX signature
3333
void push(Value value);
3434
Value pop();
3535

36-
// Native function definition (Needed for convert_native.c)
37-
void defineNative(VM* vm, const char* name, NativeFn function);
36+
// Native function helper
37+
void defineNative(const char* name, NativeFn function);
3838

3939
#endif
4040

0 commit comments

Comments
 (0)