backend.dcl 15.4 KB
Newer Older
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
1
definition module backend;
2
3
4
5
6

//1.3
from StdString import String;
//3.1

7
:: CPtr :== Int;
8
:: *UWorld :== Int;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
:: *BackEnd;
:: BESymbolP;
:: BETypeNodeP;
:: BETypeArgP;
:: BETypeAltP;
:: BENodeP;
:: BEArgP;
:: BERuleAltP;
:: BEImpRuleP;
:: BETypeP;
:: BEFlatTypeP;
:: BETypeVarP;
:: BETypeVarListP;
:: BEConstructorListP;
:: BEFieldListP;
:: BENodeIdP;
:: BENodeDefP;
:: BEStrictNodeIdP;
:: BECodeParameterP;
:: BECodeBlockP;
:: BEStringListP;
:: BENodeIdListP;
31
32
33
34
35
36
37
:: BEAnnotation :== Int;
:: BEAttribution :== Int;
:: BESymbKind :== Int;
:: BEArrayFunKind :== Int;
:: BESelectorKind :== Int;
:: BEUpdateKind :== Int;
BEGetVersion :: (!Int,!Int,!Int);
38
// void BEGetVersion (int* current,int* oldestDefinition,int* oldestImplementation);
39
BEInit :: !Int !UWorld -> (!BackEnd,!UWorld);
40
// BackEnd BEInit (int argc);
41
BEFree :: !BackEnd !UWorld -> UWorld;
42
// void BEFree (BackEnd backEnd);
43
BEArg :: !String !BackEnd -> BackEnd;
44
// void BEArg (CleanString arg);
45
BEDeclareModules :: !Int !BackEnd -> BackEnd;
46
// void BEDeclareModules (int nModules);
47
BESpecialArrayFunctionSymbol :: !BEArrayFunKind !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
48
// BESymbolP BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind,int functionIndex,int moduleIndex);
49
BEDictionarySelectFunSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
50
// BESymbolP BEDictionarySelectFunSymbol ();
51
BEDictionaryUpdateFunSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
52
// BESymbolP BEDictionaryUpdateFunSymbol ();
53
BEFunctionSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
54
// BESymbolP BEFunctionSymbol (int functionIndex,int moduleIndex);
55
BEConstructorSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
56
// BESymbolP BEConstructorSymbol (int constructorIndex,int moduleIndex);
57
BEFieldSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
58
// BESymbolP BEFieldSymbol (int fieldIndex,int moduleIndex);
59
BETypeSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
60
// BESymbolP BETypeSymbol (int typeIndex,int moduleIndex);
61
BEDontCareDefinitionSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
62
// BESymbolP BEDontCareDefinitionSymbol ();
63
BEBoolSymbol :: !Bool !BackEnd -> (!BESymbolP,!BackEnd);
64
// BESymbolP BEBoolSymbol (int value);
65
BELiteralSymbol :: !BESymbKind !String !BackEnd -> (!BESymbolP,!BackEnd);
66
// BESymbolP BELiteralSymbol (BESymbKind kind,CleanString value);
67
BEPredefineConstructorSymbol :: !Int !Int !Int !BESymbKind !BackEnd -> BackEnd;
68
// void BEPredefineConstructorSymbol (int arity,int constructorIndex,int moduleIndex,BESymbKind symbolKind);
69
BEPredefineTypeSymbol :: !Int !Int !Int !BESymbKind !BackEnd -> BackEnd;
70
// void BEPredefineTypeSymbol (int arity,int typeIndex,int moduleIndex,BESymbKind symbolKind);
71
BEBasicSymbol :: !Int !BackEnd -> (!BESymbolP,!BackEnd);
72
// BESymbolP BEBasicSymbol (BESymbKind kind);
73
BEVarTypeNode :: !String !BackEnd -> (!BETypeNodeP,!BackEnd);
74
// BETypeNodeP BEVarTypeNode (CleanString name);
75
BETypeVars :: !BETypeVarP !BETypeVarListP !BackEnd -> (!BETypeVarListP,!BackEnd);
76
// BETypeVarListP BETypeVars (BETypeVarP typeVar,BETypeVarListP typeVarList);
77
BENoTypeVars :: !BackEnd -> (!BETypeVarListP,!BackEnd);
78
// BETypeVarListP BENoTypeVars ();
79
BENormalTypeNode :: !BESymbolP !BETypeArgP !BackEnd -> (!BETypeNodeP,!BackEnd);
80
// BETypeNodeP BENormalTypeNode (BESymbolP symbol,BETypeArgP args);
81
BEAnnotateTypeNode :: !BEAnnotation !BETypeNodeP !BackEnd -> (!BETypeNodeP,!BackEnd);
82
// BETypeNodeP BEAnnotateTypeNode (BEAnnotation annotation,BETypeNodeP typeNode);
83
BEAttributeTypeNode :: !BEAttribution !BETypeNodeP !BackEnd -> (!BETypeNodeP,!BackEnd);
84
// BETypeNodeP BEAttributeTypeNode (BEAttribution attribution,BETypeNodeP typeNode);
85
BENoTypeArgs :: !BackEnd -> (!BETypeArgP,!BackEnd);
86
// BETypeArgP BENoTypeArgs ();
87
BETypeArgs :: !BETypeNodeP !BETypeArgP !BackEnd -> (!BETypeArgP,!BackEnd);
88
// BETypeArgP BETypeArgs (BETypeNodeP node,BETypeArgP nextArgs);
89
BETypeAlt :: !BETypeNodeP !BETypeNodeP !BackEnd -> (!BETypeAltP,!BackEnd);
90
// BETypeAltP BETypeAlt (BETypeNodeP lhs,BETypeNodeP rhs);
91
BENormalNode :: !BESymbolP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
92
// BENodeP BENormalNode (BESymbolP symbol,BEArgP args);
93
BEMatchNode :: !Int !BESymbolP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
94
// BENodeP BEMatchNode (int arity,BESymbolP symbol,BENodeP node);
95
BETupleSelectNode :: !Int !Int !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
96
// BENodeP BETupleSelectNode (int arity,int index,BENodeP node);
97
BEIfNode :: !BENodeP !BENodeP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
98
// BENodeP BEIfNode (BENodeP cond,BENodeP then,BENodeP elsje);
99
BEGuardNode :: !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
100
// BENodeP BEGuardNode (BENodeP cond,BENodeDefP thenNodeDefs,BEStrictNodeIdP thenStricts,BENodeP then,BENodeDefP elseNodeDefs,BEStrictNodeIdP elseStricts,BENodeP elsje);
101
102
103
104
105
106
107
108
BESwitchNode :: !BENodeIdP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
// BENodeP BESwitchNode (BENodeIdP nodeId,BEArgP caseNode);
BECaseNode :: !Int !BESymbolP !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
// BENodeP BECaseNode (int symbolArity,BESymbolP symbol,BENodeDefP nodeDefs,BEStrictNodeIdP strictNodeIds,BENodeP node);
BEPushNode :: !Int !BESymbolP !BEArgP !BENodeIdListP !BackEnd -> (!BENodeP,!BackEnd);
// BENodeP BEPushNode (int arity,BESymbolP symbol,BEArgP arguments,BENodeIdListP nodeIds);
BEDefaultNode :: !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
// BENodeP BEDefaultNode (BENodeDefP nodeDefs,BEStrictNodeIdP strictNodeIds,BENodeP node);
109
BESelectorNode :: !BESelectorKind !BESymbolP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
110
// BENodeP BESelectorNode (BESelectorKind selectorKind,BESymbolP fieldSymbol,BEArgP args);
111
BEUpdateNode :: !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
112
// BENodeP BEUpdateNode (BEArgP args);
113
BENodeIdNode :: !BENodeIdP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
114
// BENodeP BENodeIdNode (BENodeIdP nodeId,BEArgP args);
115
BENoArgs :: !BackEnd -> (!BEArgP,!BackEnd);
116
// BEArgP BENoArgs ();
117
BEArgs :: !BENodeP !BEArgP !BackEnd -> (!BEArgP,!BackEnd);
118
// BEArgP BEArgs (BENodeP node,BEArgP nextArgs);
119
BERuleAlt :: !Int !BENodeDefP !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BERuleAltP,!BackEnd);
120
// BERuleAltP BERuleAlt (int line,BENodeDefP lhsDefs,BENodeP lhs,BENodeDefP rhsDefs,BEStrictNodeIdP lhsStrictNodeIds,BENodeP rhs);
121
BERuleAlts :: !BERuleAltP !BERuleAltP !BackEnd -> (!BERuleAltP,!BackEnd);
122
// BERuleAltP BERuleAlts (BERuleAltP alt,BERuleAltP alts);
123
BENoRuleAlts :: !BackEnd -> (!BERuleAltP,!BackEnd);
124
// BERuleAltP BENoRuleAlts ();
125
BEDeclareNodeId :: !Int !Int !String !BackEnd -> BackEnd;
126
// void BEDeclareNodeId (int sequenceNumber,int lhsOrRhs,CleanString name);
127
BENodeId :: !Int !BackEnd -> (!BENodeIdP,!BackEnd);
128
// BENodeIdP BENodeId (int sequenceNumber);
129
BEWildCardNodeId :: !BackEnd -> (!BENodeIdP,!BackEnd);
130
// BENodeIdP BEWildCardNodeId ();
131
BENodeDef :: !Int !BENodeP !BackEnd -> (!BENodeDefP,!BackEnd);
132
// BENodeDefP BENodeDef (int sequenceNumber,BENodeP node);
133
BENoNodeDefs :: !BackEnd -> (!BENodeDefP,!BackEnd);
134
// BENodeDefP BENoNodeDefs ();
135
BENodeDefs :: !BENodeDefP !BENodeDefP !BackEnd -> (!BENodeDefP,!BackEnd);
136
// BENodeDefP BENodeDefs (BENodeDefP nodeDef,BENodeDefP nodeDefs);
137
BEStrictNodeId :: !BENodeIdP !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
138
// BEStrictNodeIdP BEStrictNodeId (BENodeIdP nodeId);
139
BENoStrictNodeIds :: !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
140
// BEStrictNodeIdP BENoStrictNodeIds ();
141
BEStrictNodeIds :: !BEStrictNodeIdP !BEStrictNodeIdP !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
142
// BEStrictNodeIdP BEStrictNodeIds (BEStrictNodeIdP strictNodeId,BEStrictNodeIdP strictNodeIds);
143
BERule :: !Int !Int !BETypeAltP !BERuleAltP !BackEnd -> (!BEImpRuleP,!BackEnd);
144
// BEImpRuleP BERule (int functionIndex,int isCaf,BETypeAltP type,BERuleAltP alts);
145
BEDeclareRuleType :: !Int !Int !String !BackEnd -> BackEnd;
146
// void BEDeclareRuleType (int functionIndex,int moduleIndex,CleanString name);
147
BEDefineRuleType :: !Int !Int !BETypeAltP !BackEnd -> BackEnd;
148
// void BEDefineRuleType (int functionIndex,int moduleIndex,BETypeAltP typeAlt);
149
BEAdjustArrayFunction :: !BEArrayFunKind !Int !Int !BackEnd -> BackEnd;
150
// void BEAdjustArrayFunction (BEArrayFunKind arrayFunKind,int functionIndex,int moduleIndex);
151
BENoRules :: !BackEnd -> (!BEImpRuleP,!BackEnd);
152
// BEImpRuleP BENoRules ();
153
BERules :: !BEImpRuleP !BEImpRuleP !BackEnd -> (!BEImpRuleP,!BackEnd);
154
// BEImpRuleP BERules (BEImpRuleP rule,BEImpRuleP rules);
155
BETypes :: !BETypeP !BETypeP !BackEnd -> (!BETypeP,!BackEnd);
156
// BETypeP BETypes (BETypeP type,BETypeP types);
157
BENoTypes :: !BackEnd -> (!BETypeP,!BackEnd);
158
// BETypeP BENoTypes ();
159
BEFlatType :: !BESymbolP !BETypeVarListP !BackEnd -> (!BEFlatTypeP,!BackEnd);
160
// BEFlatTypeP BEFlatType (BESymbolP symbol,BETypeVarListP arguments);
161
BEAlgebraicType :: !BEFlatTypeP !BEConstructorListP !BackEnd -> BackEnd;
162
// void BEAlgebraicType (BEFlatTypeP lhs,BEConstructorListP constructors);
163
BERecordType :: !Int !BEFlatTypeP !BETypeNodeP !BEFieldListP !BackEnd -> BackEnd;
164
// void BERecordType (int moduleIndex,BEFlatTypeP lhs,BETypeNodeP constructorType,BEFieldListP fields);
165
BEAbsType :: !BEFlatTypeP !BackEnd -> BackEnd;
166
// void BEAbsType (BEFlatTypeP lhs);
167
BEConstructors :: !BEConstructorListP !BEConstructorListP !BackEnd -> (!BEConstructorListP,!BackEnd);
168
// BEConstructorListP BEConstructors (BEConstructorListP constructor,BEConstructorListP constructors);
169
BENoConstructors :: !BackEnd -> (!BEConstructorListP,!BackEnd);
170
// BEConstructorListP BENoConstructors ();
171
BEConstructor :: !BETypeNodeP !BackEnd -> (!BEConstructorListP,!BackEnd);
172
// BEConstructorListP BEConstructor (BETypeNodeP type);
173
BEDeclareField :: !Int !Int !String !BackEnd -> BackEnd;
174
// void BEDeclareField (int fieldIndex,int moduleIndex,CleanString name);
175
BEField :: !Int !Int !BETypeNodeP !BackEnd -> (!BEFieldListP,!BackEnd);
176
// BEFieldListP BEField (int fieldIndex,int moduleIndex,BETypeNodeP type);
177
BEFields :: !BEFieldListP !BEFieldListP !BackEnd -> (!BEFieldListP,!BackEnd);
178
// BEFieldListP BEFields (BEFieldListP field,BEFieldListP fields);
179
BENoFields :: !BackEnd -> (!BEFieldListP,!BackEnd);
180
// BEFieldListP BENoFields ();
181
BEDeclareConstructor :: !Int !Int !String !BackEnd -> BackEnd;
182
// void BEDeclareConstructor (int constructorIndex,int moduleIndex,CleanString name);
183
BETypeVar :: !String !BackEnd -> (!BETypeVarP,!BackEnd);
184
// BETypeVarP BETypeVar (CleanString name);
185
BEDeclareType :: !Int !Int !String !BackEnd -> BackEnd;
186
// void BEDeclareType (int typeIndex,int moduleIndex,CleanString name);
187
BEDeclareFunction :: !String !Int !Int !Int !BackEnd -> BackEnd;
188
// void BEDeclareFunction (CleanString name,int arity,int functionIndex,int ancestor);
189
BECodeAlt :: !Int !BENodeDefP !BENodeP !BECodeBlockP !BackEnd -> (!BERuleAltP,!BackEnd);
190
// BERuleAltP BECodeAlt (int line,BENodeDefP lhsDefs,BENodeP lhs,BECodeBlockP codeBlock);
191
BEString :: !String !BackEnd -> (!BEStringListP,!BackEnd);
192
// BEStringListP BEString (CleanString cleanString);
193
BEStrings :: !BEStringListP !BEStringListP !BackEnd -> (!BEStringListP,!BackEnd);
194
// BEStringListP BEStrings (BEStringListP string,BEStringListP strings);
195
BENoStrings :: !BackEnd -> (!BEStringListP,!BackEnd);
196
// BEStringListP BENoStrings ();
197
BECodeParameter :: !String !BENodeIdP !BackEnd -> (!BECodeParameterP,!BackEnd);
198
// BECodeParameterP BECodeParameter (CleanString location,BENodeIdP nodeId);
199
BECodeParameters :: !BECodeParameterP !BECodeParameterP !BackEnd -> (!BECodeParameterP,!BackEnd);
200
// BECodeParameterP BECodeParameters (BECodeParameterP parameter,BECodeParameterP parameters);
201
BENoCodeParameters :: !BackEnd -> (!BECodeParameterP,!BackEnd);
202
// BECodeParameterP BENoCodeParameters ();
203
204
205
206
207
208
BENodeIdListElem :: !BENodeIdP !BackEnd -> (!BENodeIdListP,!BackEnd);
// BENodeIdListP BENodeIdListElem (BENodeIdP nodeId);
BENodeIds :: !BENodeIdListP !BENodeIdListP !BackEnd -> (!BENodeIdListP,!BackEnd);
// BENodeIdListP BENodeIds (BENodeIdListP nid,BENodeIdListP nids);
BENoNodeIds :: !BackEnd -> (!BENodeIdListP,!BackEnd);
// BENodeIdListP BENoNodeIds ();
209
BEAbcCodeBlock :: !Bool !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);
210
// BECodeBlockP BEAbcCodeBlock (int inline,BEStringListP instructions);
211
BEAnyCodeBlock :: !BECodeParameterP !BECodeParameterP !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);
212
// BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams,BECodeParameterP outParams,BEStringListP instructions);
213
BEDeclareIclModule :: !String !Int !Int !Int !Int !BackEnd -> BackEnd;
214
// void BEDeclareIclModule (CleanString name,int nFunctions,int nTypes,int nConstructors,int nFields);
215
BEDeclareDclModule :: !Int !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd;
216
// void BEDeclareDclModule (int moduleIndex,CleanString name,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields);
217
BEDeclarePredefinedModule :: !Int !Int !BackEnd -> BackEnd;
218
// void BEDeclarePredefinedModule (int nTypes,int nConstructors);
219
BEDefineRules :: !BEImpRuleP !BackEnd -> BackEnd;
220
// void BEDefineRules (BEImpRuleP rules);
221
BEGenerateCode :: !String !BackEnd -> (!Bool,!BackEnd);
222
// int BEGenerateCode (CleanString outputFile);
223
BEExportType :: !Int !Int !BackEnd -> BackEnd;
224
// void BEExportType (int dclTypeIndex,int iclTypeIndex);
225
BESwapTypes :: !Int !Int !BackEnd -> BackEnd;
226
// void BESwapTypes (int frm,int to);
227
BEExportConstructor :: !Int !Int !BackEnd -> BackEnd;
228
// void BEExportConstructor (int dclConstructorIndex,int iclConstructorIndex);
229
BEExportField :: !Int !Int !BackEnd -> BackEnd;
230
// void BEExportField (int dclTypeIndex,int iclTypeIndex);
231
BEExportFunction :: !Int !Int !BackEnd -> BackEnd;
232
// void BEExportFunction (int dclFunctionIndex,int iclFunctionIndex);
233
BEDefineImportedObjsAndLibs :: !BEStringListP !BEStringListP !BackEnd -> BackEnd;
234
// void BEDefineImportedObjsAndLibs (BEStringListP objs,BEStringListP libs);
235
BESetMainDclModuleN :: !Int !BackEnd -> BackEnd;
236
// void BESetMainDclModuleN (int main_dcl_module_n_parameter);
237
BEDeclareDynamicTypeSymbol :: !Int !Int !BackEnd -> BackEnd;
238
// void BEDeclareDynamicTypeSymbol (int typeIndex,int moduleIndex);
239
BEDynamicTempTypeSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
240
// BESymbolP BEDynamicTempTypeSymbol ();
241
kBEVersionCurrent:==0x02000207;
242
243
kBEVersionOldestDefinition:==0x02000204;
kBEVersionOldestImplementation:==0x02000206;
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
kBEDebug:==1;
kPredefinedModuleIndex:==1;
BENoAnnot:==0;
BEStrictAnnot:==1;
BENoUniAttr:==0;
BENotUniqueAttr:==1;
BEUniqueAttr:==2;
BEExistsAttr:==3;
BEUniqueVariable:==4;
BEFirstUniVarNumber:==5;
BEIntType:==0;
BEBoolType:==1;
BECharType:==2;
BERealType:==3;
BEFileType:==4;
BEStringType:==5;
BEWorldType:==6;
BEProcIdType:==7;
BERedIdType:==8;
BENrOfBasicTypes:==9;
BEIntDenot:==10;
BEBoolDenot:==11;
BECharDenot:==12;
BERealDenot:==13;
BENrOfBasicDenots:==14;
BEStringDenot:==15;
BEFunType:==16;
BEArrayType:==17;
BEStrictArrayType:==18;
BEUnboxedArrayType:==19;
BEListType:==20;
BETupleType:==21;
BEEmptyType:==22;
BEDynamicType:==23;
BENrOfPredefTypes:==24;
BETupleSymb:==25;
BEConsSymb:==26;
BENilSymb:==27;
BEApplySymb:==28;
BEIfSymb:==29;
BEFailSymb:==30;
BEAllSymb:==31;
BESelectSymb:==32;
BENrOfPredefFunsOrConses:==33;
BEDefinition:==34;
BENewSymbol:==35;
BEInstanceSymb:==36;
BEEmptySymbol:==37;
BEFieldSymbolList:==38;
BEErroneousSymb:==39;
BECreateArrayFun:==0;
BEArraySelectFun:==1;
BEUnqArraySelectFun:==2;
BEArrayUpdateFun:==3;
BEArrayReplaceFun:==4;
BEArraySizeFun:==5;
BEUnqArraySizeFun:==6;
BE_CreateArrayFun:==7;
BE_UnqArraySelectFun:==8;
BE_UnqArraySelectNextFun:==9;
BE_UnqArraySelectLastFun:==10;
BE_ArrayUpdateFun:==11;
BENoArrayFun:==12;
BESelectorDummy:==0;
BESelector:==1;
BESelector_U:==2;
BESelector_F:==3;
BESelector_L:==4;
BESelector_N:==5;
BEUpdateDummy:==0;
BEUpdate:==1;
BEUpdate_U:==2;
BELhsNodeId:==0;
BERhsNodeId:==1;
BEIsNotACaf:==0;
BEIsACaf:==1;