backend.dcl 14.5 KB
Newer Older
1
definition module backendC/CleanCompilerSources/backend;
2
3
4
5
6
7

//1.3
from StdString import String;
//3.1

:: *UWorld :== Int;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
:: *BackEnd :== Int;
:: BESymbolP :== Int;
:: BETypeNodeP :== Int;
:: BETypeArgP :== Int;
:: BETypeAltP :== Int;
:: BENodeP :== Int;
:: BEArgP :== Int;
:: BERuleAltP :== Int;
:: BEImpRuleP :== Int;
:: BETypeP :== Int;
:: BEFlatTypeP :== Int;
:: BETypeVarP :== Int;
:: BETypeVarListP :== Int;
:: BEConstructorListP :== Int;
:: BEFieldListP :== Int;
:: BENodeIdP :== Int;
:: BENodeDefP :== Int;
:: BEStrictNodeIdP :== Int;
:: BECodeParameterP :== Int;
:: BECodeBlockP :== Int;
:: BEStringListP :== Int;
29
30
31
32
33
34
35
:: BEAnnotation :== Int;
:: BEAttribution :== Int;
:: BESymbKind :== Int;
:: BEArrayFunKind :== Int;
:: BESelectorKind :== Int;
:: BEUpdateKind :== Int;
BEGetVersion :: (!Int,!Int,!Int);
36
// void BEGetVersion (int* current,int* oldestDefinition,int* oldestImplementation);
37
BEInit :: !Int !UWorld -> (!BackEnd,!UWorld);
38
// BackEnd BEInit (int argc);
39
BEFree :: !BackEnd !UWorld -> UWorld;
40
// void BEFree (BackEnd backEnd);
41
BEArg :: !String !BackEnd -> BackEnd;
42
// void BEArg (CleanString arg);
43
BEDeclareModules :: !Int !BackEnd -> BackEnd;
44
// void BEDeclareModules (int nModules);
45
BESpecialArrayFunctionSymbol :: !BEArrayFunKind !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
46
// BESymbolP BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind,int functionIndex,int moduleIndex);
47
BEDictionarySelectFunSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
48
// BESymbolP BEDictionarySelectFunSymbol ();
49
BEDictionaryUpdateFunSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
50
// BESymbolP BEDictionaryUpdateFunSymbol ();
51
BEFunctionSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
52
// BESymbolP BEFunctionSymbol (int functionIndex,int moduleIndex);
53
BEConstructorSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
54
// BESymbolP BEConstructorSymbol (int constructorIndex,int moduleIndex);
55
BEFieldSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
56
// BESymbolP BEFieldSymbol (int fieldIndex,int moduleIndex);
57
BETypeSymbol :: !Int !Int !BackEnd -> (!BESymbolP,!BackEnd);
58
// BESymbolP BETypeSymbol (int typeIndex,int moduleIndex);
59
BEDontCareDefinitionSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
60
// BESymbolP BEDontCareDefinitionSymbol ();
61
BEBoolSymbol :: !Bool !BackEnd -> (!BESymbolP,!BackEnd);
62
// BESymbolP BEBoolSymbol (int value);
63
BELiteralSymbol :: !BESymbKind !String !BackEnd -> (!BESymbolP,!BackEnd);
64
// BESymbolP BELiteralSymbol (BESymbKind kind,CleanString value);
65
BEPredefineConstructorSymbol :: !Int !Int !Int !BESymbKind !BackEnd -> BackEnd;
66
// void BEPredefineConstructorSymbol (int arity,int constructorIndex,int moduleIndex,BESymbKind symbolKind);
67
BEPredefineTypeSymbol :: !Int !Int !Int !BESymbKind !BackEnd -> BackEnd;
68
// void BEPredefineTypeSymbol (int arity,int typeIndex,int moduleIndex,BESymbKind symbolKind);
69
BEBasicSymbol :: !Int !BackEnd -> (!BESymbolP,!BackEnd);
70
// BESymbolP BEBasicSymbol (BESymbKind kind);
71
BEVarTypeNode :: !String !BackEnd -> (!BETypeNodeP,!BackEnd);
72
// BETypeNodeP BEVarTypeNode (CleanString name);
73
BETypeVars :: !BETypeVarP !BETypeVarListP !BackEnd -> (!BETypeVarListP,!BackEnd);
74
// BETypeVarListP BETypeVars (BETypeVarP typeVar,BETypeVarListP typeVarList);
75
BENoTypeVars :: !BackEnd -> (!BETypeVarListP,!BackEnd);
76
// BETypeVarListP BENoTypeVars ();
77
BENormalTypeNode :: !BESymbolP !BETypeArgP !BackEnd -> (!BETypeNodeP,!BackEnd);
78
// BETypeNodeP BENormalTypeNode (BESymbolP symbol,BETypeArgP args);
79
BEAnnotateTypeNode :: !BEAnnotation !BETypeNodeP !BackEnd -> (!BETypeNodeP,!BackEnd);
80
// BETypeNodeP BEAnnotateTypeNode (BEAnnotation annotation,BETypeNodeP typeNode);
81
BEAttributeTypeNode :: !BEAttribution !BETypeNodeP !BackEnd -> (!BETypeNodeP,!BackEnd);
82
// BETypeNodeP BEAttributeTypeNode (BEAttribution attribution,BETypeNodeP typeNode);
83
BENoTypeArgs :: !BackEnd -> (!BETypeArgP,!BackEnd);
84
// BETypeArgP BENoTypeArgs ();
85
BETypeArgs :: !BETypeNodeP !BETypeArgP !BackEnd -> (!BETypeArgP,!BackEnd);
86
// BETypeArgP BETypeArgs (BETypeNodeP node,BETypeArgP nextArgs);
87
BETypeAlt :: !BETypeNodeP !BETypeNodeP !BackEnd -> (!BETypeAltP,!BackEnd);
88
// BETypeAltP BETypeAlt (BETypeNodeP lhs,BETypeNodeP rhs);
89
BENormalNode :: !BESymbolP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
90
// BENodeP BENormalNode (BESymbolP symbol,BEArgP args);
91
BEMatchNode :: !Int !BESymbolP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
92
// BENodeP BEMatchNode (int arity,BESymbolP symbol,BENodeP node);
93
BETupleSelectNode :: !Int !Int !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
94
// BENodeP BETupleSelectNode (int arity,int index,BENodeP node);
95
BEIfNode :: !BENodeP !BENodeP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
96
// BENodeP BEIfNode (BENodeP cond,BENodeP then,BENodeP elsje);
97
BEGuardNode :: !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BENodeP,!BackEnd);
98
// BENodeP BEGuardNode (BENodeP cond,BENodeDefP thenNodeDefs,BEStrictNodeIdP thenStricts,BENodeP then,BENodeDefP elseNodeDefs,BEStrictNodeIdP elseStricts,BENodeP elsje);
99
BESelectorNode :: !BESelectorKind !BESymbolP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
100
// BENodeP BESelectorNode (BESelectorKind selectorKind,BESymbolP fieldSymbol,BEArgP args);
101
BEUpdateNode :: !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
102
// BENodeP BEUpdateNode (BEArgP args);
103
BENodeIdNode :: !BENodeIdP !BEArgP !BackEnd -> (!BENodeP,!BackEnd);
104
// BENodeP BENodeIdNode (BENodeIdP nodeId,BEArgP args);
105
BENoArgs :: !BackEnd -> (!BEArgP,!BackEnd);
106
// BEArgP BENoArgs ();
107
BEArgs :: !BENodeP !BEArgP !BackEnd -> (!BEArgP,!BackEnd);
108
// BEArgP BEArgs (BENodeP node,BEArgP nextArgs);
109
BERuleAlt :: !Int !BENodeDefP !BENodeP !BENodeDefP !BEStrictNodeIdP !BENodeP !BackEnd -> (!BERuleAltP,!BackEnd);
110
// BERuleAltP BERuleAlt (int line,BENodeDefP lhsDefs,BENodeP lhs,BENodeDefP rhsDefs,BEStrictNodeIdP lhsStrictNodeIds,BENodeP rhs);
111
BERuleAlts :: !BERuleAltP !BERuleAltP !BackEnd -> (!BERuleAltP,!BackEnd);
112
// BERuleAltP BERuleAlts (BERuleAltP alt,BERuleAltP alts);
113
BENoRuleAlts :: !BackEnd -> (!BERuleAltP,!BackEnd);
114
// BERuleAltP BENoRuleAlts ();
115
BEDeclareNodeId :: !Int !Int !String !BackEnd -> BackEnd;
116
// void BEDeclareNodeId (int sequenceNumber,int lhsOrRhs,CleanString name);
117
BENodeId :: !Int !BackEnd -> (!BENodeIdP,!BackEnd);
118
// BENodeIdP BENodeId (int sequenceNumber);
119
BEWildCardNodeId :: !BackEnd -> (!BENodeIdP,!BackEnd);
120
// BENodeIdP BEWildCardNodeId ();
121
BENodeDef :: !Int !BENodeP !BackEnd -> (!BENodeDefP,!BackEnd);
122
// BENodeDefP BENodeDef (int sequenceNumber,BENodeP node);
123
BENoNodeDefs :: !BackEnd -> (!BENodeDefP,!BackEnd);
124
// BENodeDefP BENoNodeDefs ();
125
BENodeDefs :: !BENodeDefP !BENodeDefP !BackEnd -> (!BENodeDefP,!BackEnd);
126
// BENodeDefP BENodeDefs (BENodeDefP nodeDef,BENodeDefP nodeDefs);
127
BEStrictNodeId :: !BENodeIdP !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
128
// BEStrictNodeIdP BEStrictNodeId (BENodeIdP nodeId);
129
BENoStrictNodeIds :: !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
130
// BEStrictNodeIdP BENoStrictNodeIds ();
131
BEStrictNodeIds :: !BEStrictNodeIdP !BEStrictNodeIdP !BackEnd -> (!BEStrictNodeIdP,!BackEnd);
132
// BEStrictNodeIdP BEStrictNodeIds (BEStrictNodeIdP strictNodeId,BEStrictNodeIdP strictNodeIds);
133
BERule :: !Int !Int !BETypeAltP !BERuleAltP !BackEnd -> (!BEImpRuleP,!BackEnd);
134
// BEImpRuleP BERule (int functionIndex,int isCaf,BETypeAltP type,BERuleAltP alts);
135
BEDeclareRuleType :: !Int !Int !String !BackEnd -> BackEnd;
136
// void BEDeclareRuleType (int functionIndex,int moduleIndex,CleanString name);
137
BEDefineRuleType :: !Int !Int !BETypeAltP !BackEnd -> BackEnd;
138
// void BEDefineRuleType (int functionIndex,int moduleIndex,BETypeAltP typeAlt);
139
BEAdjustArrayFunction :: !BEArrayFunKind !Int !Int !BackEnd -> BackEnd;
140
// void BEAdjustArrayFunction (BEArrayFunKind arrayFunKind,int functionIndex,int moduleIndex);
141
BENoRules :: !BackEnd -> (!BEImpRuleP,!BackEnd);
142
// BEImpRuleP BENoRules ();
143
BERules :: !BEImpRuleP !BEImpRuleP !BackEnd -> (!BEImpRuleP,!BackEnd);
144
// BEImpRuleP BERules (BEImpRuleP rule,BEImpRuleP rules);
145
BETypes :: !BETypeP !BETypeP !BackEnd -> (!BETypeP,!BackEnd);
146
// BETypeP BETypes (BETypeP type,BETypeP types);
147
BENoTypes :: !BackEnd -> (!BETypeP,!BackEnd);
148
// BETypeP BENoTypes ();
149
BEFlatType :: !BESymbolP !BETypeVarListP !BackEnd -> (!BEFlatTypeP,!BackEnd);
150
// BEFlatTypeP BEFlatType (BESymbolP symbol,BETypeVarListP arguments);
151
BEAlgebraicType :: !BEFlatTypeP !BEConstructorListP !BackEnd -> BackEnd;
152
// void BEAlgebraicType (BEFlatTypeP lhs,BEConstructorListP constructors);
153
BERecordType :: !Int !BEFlatTypeP !BETypeNodeP !BEFieldListP !BackEnd -> BackEnd;
154
// void BERecordType (int moduleIndex,BEFlatTypeP lhs,BETypeNodeP constructorType,BEFieldListP fields);
155
BEAbsType :: !BEFlatTypeP !BackEnd -> BackEnd;
156
// void BEAbsType (BEFlatTypeP lhs);
157
BEConstructors :: !BEConstructorListP !BEConstructorListP !BackEnd -> (!BEConstructorListP,!BackEnd);
158
// BEConstructorListP BEConstructors (BEConstructorListP constructor,BEConstructorListP constructors);
159
BENoConstructors :: !BackEnd -> (!BEConstructorListP,!BackEnd);
160
// BEConstructorListP BENoConstructors ();
161
BEConstructor :: !BETypeNodeP !BackEnd -> (!BEConstructorListP,!BackEnd);
162
// BEConstructorListP BEConstructor (BETypeNodeP type);
163
BEDeclareField :: !Int !Int !String !BackEnd -> BackEnd;
164
// void BEDeclareField (int fieldIndex,int moduleIndex,CleanString name);
165
BEField :: !Int !Int !BETypeNodeP !BackEnd -> (!BEFieldListP,!BackEnd);
166
// BEFieldListP BEField (int fieldIndex,int moduleIndex,BETypeNodeP type);
167
BEFields :: !BEFieldListP !BEFieldListP !BackEnd -> (!BEFieldListP,!BackEnd);
168
// BEFieldListP BEFields (BEFieldListP field,BEFieldListP fields);
169
BENoFields :: !BackEnd -> (!BEFieldListP,!BackEnd);
170
// BEFieldListP BENoFields ();
171
BEDeclareConstructor :: !Int !Int !String !BackEnd -> BackEnd;
172
// void BEDeclareConstructor (int constructorIndex,int moduleIndex,CleanString name);
173
BETypeVar :: !String !BackEnd -> (!BETypeVarP,!BackEnd);
174
// BETypeVarP BETypeVar (CleanString name);
175
BEDeclareType :: !Int !Int !String !BackEnd -> BackEnd;
176
// void BEDeclareType (int typeIndex,int moduleIndex,CleanString name);
177
BEDeclareFunction :: !String !Int !Int !Int !BackEnd -> BackEnd;
178
// void BEDeclareFunction (CleanString name,int arity,int functionIndex,int ancestor);
179
BECodeAlt :: !Int !BENodeDefP !BENodeP !BECodeBlockP !BackEnd -> (!BERuleAltP,!BackEnd);
180
// BERuleAltP BECodeAlt (int line,BENodeDefP lhsDefs,BENodeP lhs,BECodeBlockP codeBlock);
181
BEString :: !String !BackEnd -> (!BEStringListP,!BackEnd);
182
// BEStringListP BEString (CleanString cleanString);
183
BEStrings :: !BEStringListP !BEStringListP !BackEnd -> (!BEStringListP,!BackEnd);
184
// BEStringListP BEStrings (BEStringListP string,BEStringListP strings);
185
BENoStrings :: !BackEnd -> (!BEStringListP,!BackEnd);
186
// BEStringListP BENoStrings ();
187
BECodeParameter :: !String !BENodeIdP !BackEnd -> (!BECodeParameterP,!BackEnd);
188
// BECodeParameterP BECodeParameter (CleanString location,BENodeIdP nodeId);
189
BECodeParameters :: !BECodeParameterP !BECodeParameterP !BackEnd -> (!BECodeParameterP,!BackEnd);
190
// BECodeParameterP BECodeParameters (BECodeParameterP parameter,BECodeParameterP parameters);
191
BENoCodeParameters :: !BackEnd -> (!BECodeParameterP,!BackEnd);
192
// BECodeParameterP BENoCodeParameters ();
193
BEAbcCodeBlock :: !Bool !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);
194
// BECodeBlockP BEAbcCodeBlock (int inline,BEStringListP instructions);
195
BEAnyCodeBlock :: !BECodeParameterP !BECodeParameterP !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);
196
// BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams,BECodeParameterP outParams,BEStringListP instructions);
197
BEDeclareIclModule :: !String !Int !Int !Int !Int !BackEnd -> BackEnd;
198
// void BEDeclareIclModule (CleanString name,int nFunctions,int nTypes,int nConstructors,int nFields);
199
BEDeclareDclModule :: !Int !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd;
200
// void BEDeclareDclModule (int moduleIndex,CleanString name,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields);
201
BEDeclarePredefinedModule :: !Int !Int !BackEnd -> BackEnd;
202
// void BEDeclarePredefinedModule (int nTypes,int nConstructors);
203
BEDefineRules :: !BEImpRuleP !BackEnd -> BackEnd;
204
// void BEDefineRules (BEImpRuleP rules);
205
BEGenerateCode :: !String !BackEnd -> (!Bool,!BackEnd);
206
// int BEGenerateCode (CleanString outputFile);
207
BEExportType :: !Int !Int !BackEnd -> BackEnd;
208
// void BEExportType (int dclTypeIndex,int iclTypeIndex);
209
BESwapTypes :: !Int !Int !BackEnd -> BackEnd;
210
// void BESwapTypes (int frm,int to);
211
BEExportConstructor :: !Int !Int !BackEnd -> BackEnd;
212
// void BEExportConstructor (int dclConstructorIndex,int iclConstructorIndex);
213
BEExportField :: !Int !Int !BackEnd -> BackEnd;
214
// void BEExportField (int dclTypeIndex,int iclTypeIndex);
215
BEExportFunction :: !Int !Int !BackEnd -> BackEnd;
216
// void BEExportFunction (int dclFunctionIndex,int iclFunctionIndex);
217
BEDefineImportedObjsAndLibs :: !BEStringListP !BEStringListP !BackEnd -> BackEnd;
218
// void BEDefineImportedObjsAndLibs (BEStringListP objs,BEStringListP libs);
219
BESetMainDclModuleN :: !Int !BackEnd -> BackEnd;
220
// void BESetMainDclModuleN (int main_dcl_module_n_parameter);
221
BEDeclareDynamicTypeSymbol :: !Int !Int !BackEnd -> BackEnd;
222
// void BEDeclareDynamicTypeSymbol (int typeIndex,int moduleIndex);
223
BEDynamicTempTypeSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);
224
// BESymbolP BEDynamicTempTypeSymbol ();
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
kBEVersionCurrent:==0x02000206;
kBEVersionOldestDefinition:==0x02000204;
kBEVersionOldestImplementation:==0x02000206;
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;