| 1 | /* $Header$ */cxx . . $ `<file>/tads3/tcprstyp.h`/ |
| 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_Hcxx . . $ `tads3/tcprstyp.h:23:9`! |
| 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_tcxx . . $ tc_constval_type_t# |
| 34 | { |
| 35 | TC_CVT_UNKcxx . . $ TC_CVT_UNK., /* unknown type or non-constant value */ |
| 36 | TC_CVT_NILcxx . . $ TC_CVT_NIL., /* nil */ |
| 37 | TC_CVT_TRUEcxx . . $ TC_CVT_TRUE., /* true */ |
| 38 | TC_CVT_INTcxx . . $ TC_CVT_INT., /* integer value */ |
| 39 | TC_CVT_SSTRcxx . . $ TC_CVT_SSTR., /* single-quoted string value */ |
| 40 | TC_CVT_RESTRcxx . . $ TC_CVT_RESTR., /* regex string value (R'...' or R"...") */ |
| 41 | TC_CVT_LISTcxx . . $ TC_CVT_LIST., /* list constant */ |
| 42 | TC_CVT_OBJcxx . . $ TC_CVT_OBJ., /* object reference */ |
| 43 | TC_CVT_PROPcxx . . $ TC_CVT_PROP., /* property pointer */ |
| 44 | TC_CVT_FUNCPTRcxx . . $ TC_CVT_FUNCPTR., /* function pointer */ |
| 45 | TC_CVT_VOCAB_LISTcxx . . $ TC_CVT_VOCAB_LIST., /* vocabulary list placeholder */ |
| 46 | TC_CVT_ANONFUNCPTRcxx . . $ TC_CVT_ANONFUNCPTR., /* anonymous function pointer */ |
| 47 | TC_CVT_ENUMcxx . . $ TC_CVT_ENUM., /* enumerator */ |
| 48 | TC_CVT_FLOATcxx . . $ TC_CVT_FLOAT., /* floating point number */ |
| 49 | TC_CVT_BIFPTRcxx . . $ TC_CVT_BIFPTR. /* pointer to built-in function */ |
| 50 | }; |
| 51 | |
| 52 | /* ------------------------------------------------------------------------ */ |
| 53 | /* |
| 54 | * Symbol types. These values are stored in symbol export files, so the |
| 55 | * order of these entries must not be changed. If new entries are to be |
| 56 | * added, they must be added at the end of the list, and existing |
| 57 | * entries must not be deleted (instead, make an existing entry |
| 58 | * obsolete, but leave its slot occupied). |
| 59 | */ |
| 60 | enum tc_symtype_tcxx . . $ tc_symtype_t# |
| 61 | { |
| 62 | /* unknown */ |
| 63 | TC_SYM_UNKNOWNcxx . . $ TC_SYM_UNKNOWN. = 0, |
| 64 | |
| 65 | /* function */ |
| 66 | TC_SYM_FUNCcxx . . $ TC_SYM_FUNC., |
| 67 | |
| 68 | /* object */ |
| 69 | TC_SYM_OBJcxx . . $ TC_SYM_OBJ., |
| 70 | |
| 71 | /* property */ |
| 72 | TC_SYM_PROPcxx . . $ TC_SYM_PROP., |
| 73 | |
| 74 | /* local variable */ |
| 75 | TC_SYM_LOCALcxx . . $ TC_SYM_LOCAL., |
| 76 | |
| 77 | /* parameter */ |
| 78 | TC_SYM_PARAMcxx . . $ TC_SYM_PARAM., |
| 79 | |
| 80 | /* built-in function */ |
| 81 | TC_SYM_BIFcxx . . $ TC_SYM_BIF., |
| 82 | |
| 83 | /* external function */ |
| 84 | TC_SYM_EXTFNcxx . . $ TC_SYM_EXTFN., |
| 85 | |
| 86 | /* code label */ |
| 87 | TC_SYM_LABELcxx . . $ TC_SYM_LABEL., |
| 88 | |
| 89 | /* metaclass */ |
| 90 | TC_SYM_METACLASScxx . . $ TC_SYM_METACLASS., |
| 91 | |
| 92 | /* enumerator */ |
| 93 | TC_SYM_ENUMcxx . . $ TC_SYM_ENUM., |
| 94 | |
| 95 | /* 'grammar token' */ |
| 96 | TC_SYM_GRAMTOKcxx . . $ TC_SYM_GRAMTOK., |
| 97 | |
| 98 | /* dynamic local (enclosing local for DynamicFunc compilation) */ |
| 99 | TC_SYM_DYNLOCALcxx . . $ TC_SYM_DYNLOCAL. |
| 100 | }; |
| 101 | |
| 102 | /* ------------------------------------------------------------------------ */ |
| 103 | /* |
| 104 | * Object metaclasses. These are the *internal* identifiers we use for the |
| 105 | * T3 metaclasses that the compiler knows about. |
| 106 | * |
| 107 | * These identifiers don't correspond to anything at run-time or in the VM |
| 108 | * - they're not "dependency table index" values (see the T3 VM spec), for |
| 109 | * example. These are simply identifiers we use internally to keep track |
| 110 | * of the metaclass of each static object we define. Note that we don't |
| 111 | * need to list all of the metaclasses here; we only need internal |
| 112 | * identifiers for the metaclasses which the compiler instantiates as |
| 113 | * static objects. Beyond these, the source program can define any number |
| 114 | * of additional metaclasses, for which we'll happily generate code for |
| 115 | * *run-time* instantiation. But for static instantiation, we only can - |
| 116 | * and only need to - generate code for this small set of metaclasses of |
| 117 | * which the compiler itself is aware. |
| 118 | */ |
| 119 | enum tc_metaclass_tcxx . . $ tc_metaclass_t# |
| 120 | { |
| 121 | /* invalid/unknown */ |
| 122 | TC_META_UNKNOWNcxx . . $ TC_META_UNKNOWN. = -1, |
| 123 | |
| 124 | /* TADS object */ |
| 125 | TC_META_TADSOBJcxx . . $ TC_META_TADSOBJ. = 0, |
| 126 | |
| 127 | /* dictionary */ |
| 128 | TC_META_DICTcxx . . $ TC_META_DICT., |
| 129 | |
| 130 | /* grammar production */ |
| 131 | TC_META_GRAMPRODcxx . . $ TC_META_GRAMPROD., |
| 132 | |
| 133 | /* intrinsic class modifier */ |
| 134 | TC_META_ICMODcxx . . $ TC_META_ICMOD. |
| 135 | }; |
| 136 | |
| 137 | |
| 138 | /* ------------------------------------------------------------------------ */ |
| 139 | /* |
| 140 | * CTcPrsNode::adjust_for_dyn() information structure |
| 141 | */ |
| 142 | struct tcpn_dyncomp_infocxx . . $ tcpn_dyncomp_info# |
| 143 | { |
| 144 | tcpn_dyncomp_infocxx . . $ tcpn_dyncomp_info#tcpn_dyncomp_info(49f6e7a06ebc5aa8).() |
| 145 | { |
| 146 | debuggercxx . . $ tcpn_dyncomp_info#debugger. = FALSEcxx . . $ `tads3/t3std.h:336:10`!; |
| 147 | speculativecxx . . $ tcpn_dyncomp_info#speculative. = FALSEcxx . . $ `tads3/t3std.h:336:10`!; |
| 148 | stack_levelcxx . . $ tcpn_dyncomp_info#stack_level. = 0; |
| 149 | } |
| 150 | |
| 151 | tcpn_dyncomp_infocxx . . $ tcpn_dyncomp_info#tcpn_dyncomp_info(b1146eedae1e1d0b).(int debugger, int speculative, int stack_level) |
| 152 | { |
| 153 | this->debuggercxx . . $ tcpn_dyncomp_info#debugger. = debugger; |
| 154 | this->speculativecxx . . $ tcpn_dyncomp_info#speculative. = speculative; |
| 155 | this->stack_levelcxx . . $ tcpn_dyncomp_info#stack_level. = stack_level; |
| 156 | } |
| 157 | |
| 158 | /* true -> debugger evaluation */ |
| 159 | int debuggercxx . . $ tcpn_dyncomp_info#debugger.; |
| 160 | |
| 161 | /* true -> speculative evaluation mode */ |
| 162 | int speculativecxx . . $ tcpn_dyncomp_info#speculative.; |
| 163 | |
| 164 | /* |
| 165 | * stack level - 0 is the active level, 1 is the first enclosing level, |
| 166 | * and so on |
| 167 | */ |
| 168 | int stack_levelcxx . . $ tcpn_dyncomp_info#stack_level.; |
| 169 | }; |
| 170 | |
| 171 | |
| 172 | #endif /* TCPRSTYP_H */ |