Files
cground/src/interpreter.h
2026-03-02 10:09:10 +11:00

30 lines
944 B
C

#ifndef INTERPRETER_H
#define INTERPRETER_H
#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, RETURN_TYPE_MISMATCH, PREMATURE_EOF, INVALID_INSTRUCTION, FIXME
} GroundRuntimeError;
typedef enum GroundDebugInstructionType {
DUMP, INSPECT, EVAL, CONTINUE, EXIT, STEP, VIEW, HELP, UNKNOWN
} GroundDebugInstructionType;
typedef struct GroundDebugInstruction {
GroundDebugInstructionType type;
char* arg;
} GroundDebugInstruction;
GroundStruct parseStruct(GroundProgram* in, GroundScope* scope, size_t errorOffset);
GroundFunction* parseFunction(GroundProgram* in, size_t errorOffset);
GroundValue interpretGroundProgram(GroundProgram* in, GroundScope* inScope);
GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scope);
#endif