cfad47cfa3/tads3/tcprstyp.h

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
/* $Header$ */
2
3
/* 
4
 *   Copyright (c) 2000, 2002 Michael J. Roberts.  All Rights Reserved.
5
 *   
6
 *   Please see the accompanying license file, LICENSE.TXT, for information
7
 *   on using and copying this software.  
8
 */
9
/*
10
Name
11
  tcprstyp.h - TADS 3 compiler - parser type definitions
12
Function
13
  Defines some types for the TADS 3 compiler's parser.  Separated from
14
  the main parser include file to reduce the amount of the parser that
15
  has to be included simply for the type definitions.
16
Notes
17
  
18
Modified
19
  04/09/00 MJRoberts  - Creation
20
*/
21
22
#ifndef TCPRSTYP_H
23
#define TCPRSTYP_H
24
25
26
/* ------------------------------------------------------------------------ */
27
/*
28
 *   Expression evaluation constant value types.  As we evaluate an
29
 *   expression, we'll attempt to evaluate the constant elements of the
30
 *   expression, so that the code we generate has any constant expressions
31
 *   computed at compile-time rather than executed at run-time.
32
 */
33
enum tc_constval_type_t
34
{
35
    TC_CVT_UNK,                      /* unknown type or non-constant value  */
36
    TC_CVT_NIL,                                                      /* nil */
37
    TC_CVT_TRUE,                                                    /* true */
38
    TC_CVT_INT,                                            /* integer value */
39
    TC_CVT_SSTR,                              /* single-quoted string value */
40
    TC_CVT_LIST,                                           /* list constant */
41
    TC_CVT_OBJ,                                         /* object reference */
42
    TC_CVT_PROP,                                        /* property pointer */
43
    TC_CVT_FUNCPTR,                                     /* function pointer */
44
    TC_CVT_VOCAB_LIST,                       /* vocabulary list placeholder */
45
    TC_CVT_ANONFUNCPTR,                       /* anonymous function pointer */
46
    TC_CVT_ENUM,                                              /* enumerator */
47
    TC_CVT_FLOAT                                   /* floating point number */
48
};
49
50
/* ------------------------------------------------------------------------ */
51
/*
52
 *   Symbol types.  These values are stored in symbol export files, so the
53
 *   order of these entries must not be changed.  If new entries are to be
54
 *   added, they must be added at the end of the list, and existing
55
 *   entries must not be deleted (instead, make an existing entry
56
 *   obsolete, but leave its slot occupied).  
57
 */
58
enum tc_symtype_t
59
{
60
    /* unknown */
61
    TC_SYM_UNKNOWN = 0,
62
63
    /* function */
64
    TC_SYM_FUNC,
65
66
    /* object */
67
    TC_SYM_OBJ,
68
69
    /* property */
70
    TC_SYM_PROP,
71
72
    /* local variable */
73
    TC_SYM_LOCAL,
74
75
    /* parameter */
76
    TC_SYM_PARAM,
77
78
    /* built-in function */
79
    TC_SYM_BIF,
80
81
    /* external function */
82
    TC_SYM_EXTFN,
83
84
    /* code label */
85
    TC_SYM_LABEL,
86
87
    /* metaclass */
88
    TC_SYM_METACLASS,
89
90
    /* enumerator */
91
    TC_SYM_ENUM,
92
93
    /* 'grammar token' */
94
    TC_SYM_GRAMTOK
95
};
96
97
/* ------------------------------------------------------------------------ */
98
/*
99
 *   Object metaclasses.  These are the *internal* identifiers we use for the
100
 *   T3 metaclasses that the compiler knows about.
101
 *   
102
 *   These identifiers don't correspond to anything at run-time or in the VM
103
 *   - they're not "dependency table index" values (see the T3 VM spec), for
104
 *   example.  These are simply identifiers we use internally to keep track
105
 *   of the metaclass of each static object we define.  Note that we don't
106
 *   need to list all of the metaclasses here; we only need internal
107
 *   identifiers for the metaclasses which the compiler instantiates as
108
 *   static objects.  Beyond these, the source program can define any number
109
 *   of additional metaclasses, for which we'll happily generate code for
110
 *   *run-time* instantiation.  But for static instantiation, we only can -
111
 *   and only need to - generate code for this small set of metaclasses of
112
 *   which the compiler itself is aware.  
113
 */
114
enum tc_metaclass_t
115
{
116
    /* invalid/unknown */
117
    TC_META_UNKNOWN = -1,
118
119
    /* TADS object */
120
    TC_META_TADSOBJ = 0,
121
122
    /* dictionary */
123
    TC_META_DICT,
124
125
    /* grammar production */
126
    TC_META_GRAMPROD,
127
128
    /* intrinsic class modifier */
129
    TC_META_ICMOD
130
};
131
132
133
#endif /* TCPRSTYP_H */