-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterpreter.h
More file actions
47 lines (38 loc) · 769 Bytes
/
interpreter.h
File metadata and controls
47 lines (38 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef INTERPRETER_H
#define INTERPRETER_H
#include "stmt.h"
void interpret(Code c);
void stop();
typedef struct Object Object;
typedef struct{
int count;
Object *values;
} Array;
typedef struct{
int refCount;
char *name;
int fromReturn;
int insCount;
void *environment;
} Instance;
typedef enum{
OBJECT_NULL,
OBJECT_LITERAL,
OBJECT_ARRAY,
OBJECT_ROUTINE,
OBJECT_CONTAINER,
OBJECT_INSTANCE
} ObjectType;
struct Object{
ObjectType type;
union{
Literal literal;
Array arr;
Routine routine;
Container container;
Instance* instance;
};
};
static Literal nullLiteral = {0, LIT_NULL, {0}};
static Object nullObject = {OBJECT_NULL, {{0, LIT_NULL, {0}}}};
#endif