-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodetype.h
70 lines (57 loc) · 1.46 KB
/
nodetype.h
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
60
61
62
63
64
65
66
67
68
typedef struct symbol symbrec,* symblst;
typedef unsigned int strtype;
typedef short objclass;
typedef object (*fobject)(), /* generic case */
(*f0object) (void),
(*f1object) (object),
(*f2object) (object,object),
(*f3object) (object,object,object),
(*f4object) (object,object,object,object),
(*f5object) (object,object,object,object,object),
(*f6object) (object,object,object,object,object,object);
typedef struct
{ strtype name;
int line;
char *fname;
} *labeltp, labelrec;
typedef struct
{ int n_nodes;
int n_labels;
int n_args;
symblst start_nodes;
symblst start_args;
labeltp start_labels;
symbrec* top_expr;
symbrec* top_arg;
} funcrec, *funclst;
typedef union { char* init_string; strtype name; labeltp label; int size;}
atp;
struct symbol
{ objtype type;
objclass class;
atp a;
strtype formal;
union { object val; fobject f; symbrec* expr; funclst func; } data;
symbrec* arglst;
symbrec* next;
};
typedef object (*symbfobj) (symblst);
enum
{ FUN =0x0200 /* whether expression has function type */
, DEFAULT =0x0400 /* whether final argument defaults to group */
, ARR =0x0800 /* Dummy list variable length arg */
};
enum
{ INTFUN=INTEGER|FUN
, VECFUN=VECTOR|FUN
, MATFUN=MATRIX|FUN
, VIDFUN=VOID|FUN
, INTLST=INTEGER|ARR
, VECLST=VECTOR|ARR
, MATLST=MATRIX|ARR
, VIDLST=VOID|ARR
, ARGLST=ARGTYPE|ARR
, GRPDFT=GROUP|DEFAULT
};
enum
{ VALUE, OPERATOR, FUNCTION, DUMMY, MAP, FUNCTION_COPIED, ARG, BLOCK=8 };