#ifndef INTERPRETER_H #define INTERPRETER_H #define MAX_ID_LEN 64 #include "types.h" #include "parser.h" #include "include/uthash.h" typedef enum GroundRuntimeError { ARG_TYPE_MISMATCH, TOO_FEW_ARGS, TOO_MANY_ARGS, UNKNOWN_LABEL, UNKNOWN_VARIABLE, LIST_ERROR, STRING_ERROR, MATH_ERROR, FIXME } GroundRuntimeError; 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 GroundFunctionArgs { GroundValueType type; char* name; } GroundFunctionArgs; typedef struct GroundFunction { GroundFunctionArgs* args; size_t argSize; GroundValueType returnType; GroundProgram program; } GroundFunction; typedef struct GroundFunctionWrapper { char id[MAX_ID_LEN]; GroundFunction function; UT_hash_handle hh; } GroundFunctionWrapper; typedef struct GroundScope { GroundLabel** labels; GroundVariable** variables; GroundFunctionWrapper** functions; } GroundScope; GroundValue interpretGroundProgram(GroundProgram* in, GroundScope* inScope); GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scope); #endif