-
Notifications
You must be signed in to change notification settings - Fork 17
/
tcprstyp.h
172 lines (141 loc) · 5.13 KB
/
tcprstyp.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/* $Header$ */
/*
* Copyright (c) 2000, 2002 Michael J. Roberts. All Rights Reserved.
*
* Please see the accompanying license file, LICENSE.TXT, for information
* on using and copying this software.
*/
/*
Name
tcprstyp.h - TADS 3 compiler - parser type definitions
Function
Defines some types for the TADS 3 compiler's parser. Separated from
the main parser include file to reduce the amount of the parser that
has to be included simply for the type definitions.
Notes
Modified
04/09/00 MJRoberts - Creation
*/
#ifndef TCPRSTYP_H
#define TCPRSTYP_H
/* ------------------------------------------------------------------------ */
/*
* Expression evaluation constant value types. As we evaluate an
* expression, we'll attempt to evaluate the constant elements of the
* expression, so that the code we generate has any constant expressions
* computed at compile-time rather than executed at run-time.
*/
enum tc_constval_type_t
{
TC_CVT_UNK, /* unknown type or non-constant value */
TC_CVT_NIL, /* nil */
TC_CVT_TRUE, /* true */
TC_CVT_INT, /* integer value */
TC_CVT_SSTR, /* single-quoted string value */
TC_CVT_RESTR, /* regex string value (R'...' or R"...") */
TC_CVT_LIST, /* list constant */
TC_CVT_OBJ, /* object reference */
TC_CVT_PROP, /* property pointer */
TC_CVT_FUNCPTR, /* function pointer */
TC_CVT_VOCAB_LIST, /* vocabulary list placeholder */
TC_CVT_ANONFUNCPTR, /* anonymous function pointer */
TC_CVT_ENUM, /* enumerator */
TC_CVT_FLOAT, /* floating point number */
TC_CVT_BIFPTR /* pointer to built-in function */
};
/* ------------------------------------------------------------------------ */
/*
* Symbol types. These values are stored in symbol export files, so the
* order of these entries must not be changed. If new entries are to be
* added, they must be added at the end of the list, and existing
* entries must not be deleted (instead, make an existing entry
* obsolete, but leave its slot occupied).
*/
enum tc_symtype_t
{
/* unknown */
TC_SYM_UNKNOWN = 0,
/* function */
TC_SYM_FUNC,
/* object */
TC_SYM_OBJ,
/* property */
TC_SYM_PROP,
/* local variable */
TC_SYM_LOCAL,
/* parameter */
TC_SYM_PARAM,
/* built-in function */
TC_SYM_BIF,
/* external function */
TC_SYM_EXTFN,
/* code label */
TC_SYM_LABEL,
/* metaclass */
TC_SYM_METACLASS,
/* enumerator */
TC_SYM_ENUM,
/* 'grammar token' */
TC_SYM_GRAMTOK,
/* dynamic local (enclosing local for DynamicFunc compilation) */
TC_SYM_DYNLOCAL
};
/* ------------------------------------------------------------------------ */
/*
* Object metaclasses. These are the *internal* identifiers we use for the
* T3 metaclasses that the compiler knows about.
*
* These identifiers don't correspond to anything at run-time or in the VM
* - they're not "dependency table index" values (see the T3 VM spec), for
* example. These are simply identifiers we use internally to keep track
* of the metaclass of each static object we define. Note that we don't
* need to list all of the metaclasses here; we only need internal
* identifiers for the metaclasses which the compiler instantiates as
* static objects. Beyond these, the source program can define any number
* of additional metaclasses, for which we'll happily generate code for
* *run-time* instantiation. But for static instantiation, we only can -
* and only need to - generate code for this small set of metaclasses of
* which the compiler itself is aware.
*/
enum tc_metaclass_t
{
/* invalid/unknown */
TC_META_UNKNOWN = -1,
/* TADS object */
TC_META_TADSOBJ = 0,
/* dictionary */
TC_META_DICT,
/* grammar production */
TC_META_GRAMPROD,
/* intrinsic class modifier */
TC_META_ICMOD
};
/* ------------------------------------------------------------------------ */
/*
* CTcPrsNode::adjust_for_dyn() information structure
*/
struct tcpn_dyncomp_info
{
tcpn_dyncomp_info()
{
debugger = FALSE;
speculative = FALSE;
stack_level = 0;
}
tcpn_dyncomp_info(int debugger, int speculative, int stack_level)
{
this->debugger = debugger;
this->speculative = speculative;
this->stack_level = stack_level;
}
/* true -> debugger evaluation */
int debugger;
/* true -> speculative evaluation mode */
int speculative;
/*
* stack level - 0 is the active level, 1 is the first enclosing level,
* and so on
*/
int stack_level;
};
#endif /* TCPRSTYP_H */