diff --git a/include/groundvm.h b/include/groundvm.h index 89f0152..770f947 100644 --- a/include/groundvm.h +++ b/include/groundvm.h @@ -1,5 +1,6 @@ #ifndef LIBGROUND_H #define LIBGROUND_H +#define MAX_ID_LEN 64 /* * groundvm.h @@ -165,6 +166,24 @@ typedef struct GroundObject { GroundObjectField* fields; } GroundObject; +typedef struct GroundLabel { + char id[MAX_ID_LEN]; + int lineNum; + UT_hash_handle hh; +} GroundLabel; + +typedef struct GroundVariable { + char id[MAX_ID_LEN]; + GroundValue value; + UT_hash_handle hh; +} GroundVariable; + +typedef struct GroundScope { + GroundLabel** labels; + GroundVariable** variables; + bool isMainScope; +} GroundScope; + #ifdef __cplusplus extern "C" { #endif @@ -180,6 +199,8 @@ void groundAddValueToInstruction(GroundInstruction* inst, GroundValue value); void groundAddReferenceToInstruction(GroundInstruction* inst, GroundArg value); GroundArg groundCreateReference(GroundArgType type, char* ref); +void groundAddValueToScope(GroundScope* gs, const char* name, GroundValue value); + GroundValue groundCreateValue(GroundValueType type, ...); GroundProgram groundParseFile(const char* code);