-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJaggScript.h
More file actions
59 lines (51 loc) · 1.02 KB
/
JaggScript.h
File metadata and controls
59 lines (51 loc) · 1.02 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
#define VAR_NULL 0
#define VAR_INT 1
#define VAR_BOOL 2
#define VAR_STR 3
#define VAR_FUNC 4
#define VAR_STR_REP 5
typedef enum { typeConVal, typeId, typeOpr } nodeEnum; // typeFid,
typedef struct object
{
char type; // 0 = NULL, 1 = INT, 2 = BOOL, 3 = STRING, 4 = FUNCTION
union
{
int valInt;
char valBool;
char* valStr;
struct nodeTypeTag* valFunc;
};
int valStrRep;
} object;
typedef struct
{
object val;
} conNodeType;
typedef struct
{
char* name;
int position;
} idNodeType;
typedef struct
{
int oper; /* operator */
int nops; /* number of operands */
struct nodeTypeTag **op; /* operands */
} oprNodeType;
typedef struct nodeTypeTag
{
nodeEnum type; /* type of node */
union
{
conNodeType con; /* constants */
idNodeType id; /* identifiers */
oprNodeType opr; /* operators */
};
} nodeType;
int objectToString(object o);
object ex(nodeType *p);
void defFunc(char* name, nodeType* func);
extern int sym[26];
extern char *varNames[16];
extern object varValues[16];
extern int varCount;