backend.h 20.4 KB
Newer Older
clean's avatar
clean committed
1
2
/* version info */

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
3
// increment this for every release
John van Groningen's avatar
John van Groningen committed
4
# define	kBEVersionCurrent				0x02000212
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
5
6
7

// change this to the same value as kBEVersionCurrent if the new release is not
// upward compatible (for example when a function is added)
John van Groningen's avatar
John van Groningen committed
8
# define	kBEVersionOldestDefinition		0x02000212
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
9
10
11

// change this to the same value as kBEVersionCurrent if the new release is not
// downward compatible (for example when a function is removed)
John van Groningen's avatar
John van Groningen committed
12
# define	kBEVersionOldestImplementation	0x02000212
clean's avatar
clean committed
13

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
14

clean's avatar
clean committed
15
16
17
18
# define	kBEDebug	1

/* pointer types */

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
19
20
Clean (:: CPtr :== Int)

clean's avatar
clean committed
21
22
23
Clean (:: *UWorld :== Int)

typedef struct BackEnd *BackEnd;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
24
Clean (:: *BackEnd :== CPtr)
clean's avatar
clean committed
25
26

typedef struct symbol *BESymbolP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
27
Clean (:: BESymbolP :== CPtr)
clean's avatar
clean committed
28
29

typedef struct type_node *BETypeNodeP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
30
Clean (:: BETypeNodeP :== CPtr)
clean's avatar
clean committed
31
32

typedef struct type_arg *BETypeArgP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
33
Clean (:: BETypeArgP :== CPtr)
clean's avatar
clean committed
34
35

typedef struct type_alt *BETypeAltP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
36
Clean (:: BETypeAltP :== CPtr)
clean's avatar
clean committed
37
38

typedef struct node *BENodeP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
39
Clean (:: BENodeP :== CPtr)
clean's avatar
clean committed
40
41

typedef struct arg *BEArgP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
42
Clean (:: BEArgP :== CPtr)
clean's avatar
clean committed
43
44

typedef struct rule_alt *BERuleAltP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
45
Clean (:: BERuleAltP :== CPtr)
clean's avatar
clean committed
46
47

typedef struct imp_rule *BEImpRuleP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
48
Clean (:: BEImpRuleP :== CPtr)
clean's avatar
clean committed
49
50

typedef struct type *BETypeP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
51
Clean (:: BETypeP :== CPtr)
clean's avatar
clean committed
52
53

typedef struct flat_type *BEFlatTypeP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
54
Clean (:: BEFlatTypeP :== CPtr)
clean's avatar
clean committed
55
56

typedef struct type_var *BETypeVarP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
57
Clean (:: BETypeVarP :== CPtr)
clean's avatar
clean committed
58
59

typedef struct type_var_list *BETypeVarListP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
60
Clean (:: BETypeVarListP :== CPtr)
clean's avatar
clean committed
61
62

typedef struct constructor_list *BEConstructorListP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
63
Clean (:: BEConstructorListP :== CPtr)
clean's avatar
clean committed
64
65

typedef struct field_list *BEFieldListP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
66
Clean (:: BEFieldListP :== CPtr)
clean's avatar
clean committed
67
68

typedef struct node_id *BENodeIdP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
69
Clean (:: BENodeIdP :== CPtr)
clean's avatar
clean committed
70
71

typedef struct node_def *BENodeDefP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
72
Clean (:: BENodeDefP :== CPtr)
clean's avatar
clean committed
73
74

typedef struct strict_node_id *BEStrictNodeIdP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
75
Clean (:: BEStrictNodeIdP :== CPtr)
clean's avatar
clean committed
76
77

typedef struct parameter *BECodeParameterP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
78
Clean (:: BECodeParameterP :== CPtr)
clean's avatar
clean committed
79
80

typedef struct code_block *BECodeBlockP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
81
Clean (:: BECodeBlockP :== CPtr)
clean's avatar
clean committed
82
83

typedef struct string_list *BEStringListP;
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
84
85
86
87
Clean (:: BEStringListP :== CPtr)

typedef struct node_id_list_element *BENodeIdListP;
Clean (:: BENodeIdListP :== CPtr)
clean's avatar
clean committed
88

89
90
typedef struct node_id_ref_count_list *BENodeIdRefCountListP;
Clean (:: BENodeIdRefCountListP :== CPtr)
91
92
93
94
95
96
97

typedef struct uni_var_equats *BEUniVarEquations;
Clean (:: BEUniVarEquations :== CPtr)

typedef struct attr_kind_list *BEAttributeKindList;
Clean (:: BEAttributeKindList :== CPtr)

clean's avatar
clean committed
98
/* constants */
99
/*
clean's avatar
clean committed
100
# define	kIclModuleIndex			0
101
*/
clean's avatar
clean committed
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# define	kPredefinedModuleIndex	1

/* enum types */
typedef int	BEAnnotation;
Clean (:: BEAnnotation :== Int)
enum {
	BENoAnnot, BEStrictAnnot
};

typedef int	BEAttribution;
Clean (:: BEAttribution :== Int)
enum {
	BENoUniAttr, BENotUniqueAttr, BEUniqueAttr, BEExistsAttr, BEUniqueVariable, BEFirstUniVarNumber
};

typedef int	BESymbKind;
Clean (:: BESymbKind :== Int)
enum {
	BEIntType, BEBoolType, BECharType, BERealType,
	BEFileType, BEStringType, BEWorldType, BEProcIdType,
	BERedIdType,
	BENrOfBasicTypes,

	BEIntDenot, BEBoolDenot, BECharDenot, BERealDenot,
	BENrOfBasicDenots,

	BEStringDenot,
	BEFunType, BEArrayType, BEStrictArrayType, BEUnboxedArrayType, BEListType, BETupleType, BEEmptyType,
 	BEDynamicType, 
 	BENrOfPredefTypes,
	
	BETupleSymb, BEConsSymb, BENilSymb,
	BEApplySymb, BEIfSymb, BEFailSymb, BEAllSymb,
	BESelectSymb,
	BENrOfPredefFunsOrConses,

	BEDefinition, BENewSymbol, BEInstanceSymb, BEEmptySymbol, BEFieldSymbolList,
	BEErroneousSymb
};

typedef int BEArrayFunKind;
Clean (::BEArrayFunKind :== Int)
enum {
	BECreateArrayFun, BEArraySelectFun, BEUnqArraySelectFun, BEArrayUpdateFun,
	BEArrayReplaceFun, BEArraySizeFun, BEUnqArraySizeFun,
	BE_CreateArrayFun,BE_UnqArraySelectFun,BE_UnqArraySelectNextFun,BE_UnqArraySelectLastFun,
	BE_ArrayUpdateFun,
	BENoArrayFun 
};

typedef int	BESelectorKind;
Clean (::BESelectorKind :== Int)
enum {
	BESelectorDummy, BESelector, BESelector_U, BESelector_F, BESelector_L, BESelector_N
};

typedef int	BEUpdateKind;
Clean (::BEUpdateKind :== Int)
enum {
	BEUpdateDummy, BEUpdate, BEUpdate_U
};


/* functions */

void BEGetVersion (int *current, int *oldestDefinition, int *oldestImplementation);
Clean (BEGetVersion :: (Int, Int, Int))

BackEnd BEInit (int argc);
Clean (BEInit :: Int UWorld -> (BackEnd, UWorld))

void BEFree (BackEnd backEnd);
Clean (BEFree :: BackEnd UWorld -> UWorld)

void BEArg (CleanString arg);
Clean (BEArg :: String BackEnd -> BackEnd)

void BEDeclareModules (int nModules);
Clean (BEDeclareModules :: Int BackEnd -> BackEnd)

BESymbolP BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex);
Clean (BESpecialArrayFunctionSymbol :: BEArrayFunKind Int Int BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEDictionarySelectFunSymbol (void);
Clean (BEDictionarySelectFunSymbol :: BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEDictionaryUpdateFunSymbol (void);
Clean (BEDictionaryUpdateFunSymbol :: BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEFunctionSymbol (int functionIndex, int moduleIndex);
Clean (BEFunctionSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEConstructorSymbol (int constructorIndex, int moduleIndex);
Clean (BEConstructorSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEFieldSymbol (int fieldIndex, int moduleIndex);
Clean (BEFieldSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))

BESymbolP BETypeSymbol (int typeIndex, int moduleIndex);
Clean (BETypeSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEDontCareDefinitionSymbol (void);
Clean (BEDontCareDefinitionSymbol :: BackEnd -> (BESymbolP, BackEnd))

BESymbolP BEBoolSymbol (int value);
Clean (BEBoolSymbol :: Bool BackEnd -> (BESymbolP, BackEnd))

BESymbolP BELiteralSymbol (BESymbKind kind, CleanString value);
Clean (BELiteralSymbol :: BESymbKind String BackEnd -> (BESymbolP, BackEnd))

212
213
214

void BEPredefineListConstructorSymbol (int constructorIndex, int moduleIndex, BESymbKind symbolKind,int head_strictness,int tail_strictness);
Clean (BEPredefineListConstructorSymbol :: Int Int BESymbKind Int Int BackEnd -> BackEnd)
215
216
217

void BEPredefineListTypeSymbol (int typeIndex, int moduleIndex, BESymbKind symbolKind,int head_strictness,int tail_strictness);
Clean (BEPredefineListTypeSymbol :: Int Int BESymbKind Int Int BackEnd -> BackEnd)
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233

void BEAdjustStrictListConsInstance (int functionIndex, int moduleIndex);
Clean (BEAdjustStrictListConsInstance :: Int Int BackEnd -> BackEnd)

void BEAdjustUnboxedListDeconsInstance (int functionIndex, int moduleIndex);
Clean (BEAdjustUnboxedListDeconsInstance :: Int Int BackEnd -> BackEnd)

void BEAdjustOverloadedNilFunction (int functionIndex,int moduleIndex);
Clean (BEAdjustOverloadedNilFunction :: Int Int BackEnd -> BackEnd)

BESymbolP BEOverloadedConsSymbol (int constructorIndex,int moduleIndex,int deconsIndex,int deconsModuleIndex);
Clean (BEOverloadedConsSymbol :: Int Int Int Int BackEnd -> (BESymbolP,BackEnd))

BENodeP BEOverloadedPushNode (int arity,BESymbolP symbol,BEArgP arguments,BENodeIdListP nodeIds,BENodeP decons_node);
Clean (BEOverloadedPushNode :: Int BESymbolP BEArgP BENodeIdListP BENodeP BackEnd -> (BENodeP, BackEnd))

234

clean's avatar
clean committed
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
void BEPredefineConstructorSymbol (int arity, int constructorIndex, int moduleIndex, BESymbKind symbolKind);
Clean (BEPredefineConstructorSymbol :: Int Int Int BESymbKind BackEnd -> BackEnd)

void BEPredefineTypeSymbol (int arity, int typeIndex, int moduleIndex, BESymbKind symbolKind);
Clean (BEPredefineTypeSymbol :: Int Int Int BESymbKind BackEnd -> BackEnd)

BESymbolP BEBasicSymbol (BESymbKind kind);
Clean (BEBasicSymbol :: Int BackEnd -> (BESymbolP, BackEnd))

BETypeNodeP BEVarTypeNode (CleanString name);
Clean (BEVarTypeNode :: String BackEnd -> (BETypeNodeP, BackEnd))

BETypeVarListP BETypeVars (BETypeVarP typeVar, BETypeVarListP typeVarList);
Clean (BETypeVars :: BETypeVarP BETypeVarListP BackEnd -> (BETypeVarListP, BackEnd))

BETypeVarListP BENoTypeVars (void);
Clean (BENoTypeVars :: BackEnd -> (BETypeVarListP, BackEnd))

BETypeNodeP BENormalTypeNode (BESymbolP symbol, BETypeArgP args);
Clean (BENormalTypeNode :: BESymbolP BETypeArgP BackEnd -> (BETypeNodeP, BackEnd))

BETypeNodeP BEAnnotateTypeNode (BEAnnotation annotation, BETypeNodeP typeNode);
Clean (BEAnnotateTypeNode :: BEAnnotation BETypeNodeP BackEnd -> (BETypeNodeP, BackEnd))

BETypeNodeP BEAttributeTypeNode (BEAttribution attribution, BETypeNodeP typeNode);
Clean (BEAttributeTypeNode :: BEAttribution BETypeNodeP BackEnd -> (BETypeNodeP, BackEnd))

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
BEAttributeKindList BEAttributeKind (BEAttribution attributeKind);
Clean (BEAttributeKind :: BEAttribution BackEnd -> (BEAttributeKindList, BackEnd))

BEAttributeKindList BENoAttributeKinds (void);
Clean (BENoAttributeKinds :: BackEnd -> (BEAttributeKindList, BackEnd))

BEAttributeKindList BEAttributeKinds (BEAttributeKindList elem, BEAttributeKindList list);
Clean (BEAttributeKinds :: BEAttributeKindList BEAttributeKindList BackEnd -> (BEAttributeKindList, BackEnd))

BEUniVarEquations BEUniVarEquation (BEAttribution demanded, BEAttributeKindList offered);
Clean (BEUniVarEquation ::BEAttribution BEAttributeKindList BackEnd -> (BEUniVarEquations, BackEnd))

BEUniVarEquations BENoUniVarEquations (void);
Clean (BENoUniVarEquations :: BackEnd -> (BEUniVarEquations, BackEnd))

BEUniVarEquations BEUniVarEquationsList (BEUniVarEquations elem, BEUniVarEquations list);
Clean (BEUniVarEquationsList ::BEUniVarEquations BEUniVarEquations BackEnd -> (BEUniVarEquations, BackEnd))

clean's avatar
clean committed
280
281
282
283
284
285
BETypeArgP BENoTypeArgs (void);
Clean (BENoTypeArgs :: BackEnd -> (BETypeArgP, BackEnd))

BETypeArgP BETypeArgs (BETypeNodeP node, BETypeArgP nextArgs);
Clean (BETypeArgs :: BETypeNodeP BETypeArgP BackEnd -> (BETypeArgP, BackEnd))

286
287
BETypeAltP BETypeAlt (BETypeNodeP lhs, BETypeNodeP rhs, BEUniVarEquations attributeEquations);
Clean (BETypeAlt :: BETypeNodeP BETypeNodeP BEUniVarEquations BackEnd -> (BETypeAltP, BackEnd))
clean's avatar
clean committed
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

BENodeP BENormalNode (BESymbolP symbol, BEArgP args);
Clean (BENormalNode :: BESymbolP BEArgP BackEnd -> (BENodeP, BackEnd))

BENodeP BEMatchNode (int arity, BESymbolP symbol, BENodeP node);
Clean (BEMatchNode :: Int BESymbolP BENodeP BackEnd -> (BENodeP, BackEnd))

BENodeP BETupleSelectNode (int arity, int index, BENodeP node);
Clean (BETupleSelectNode :: Int Int BENodeP BackEnd -> (BENodeP, BackEnd))

BENodeP BEIfNode (BENodeP cond, BENodeP then, BENodeP elsje);
Clean (BEIfNode :: BENodeP BENodeP BENodeP BackEnd -> (BENodeP, BackEnd))

BENodeP BEGuardNode (BENodeP cond, BENodeDefP thenNodeDefs, BEStrictNodeIdP thenStricts, BENodeP then, BENodeDefP elseNodeDefs, BEStrictNodeIdP elseStricts, BENodeP elsje);
Clean (BEGuardNode :: BENodeP BENodeDefP BEStrictNodeIdP BENodeP BENodeDefP  BEStrictNodeIdP BENodeP BackEnd -> (BENodeP, BackEnd))

304
305
306
307
308
309
void BESetNodeDefRefCounts (BENodeP lhs);
Clean (BESetNodeDefRefCounts :: BENodeP BackEnd -> BackEnd)

void BEAddNodeIdsRefCounts (int sequenceNumber, BESymbolP symbol, BENodeIdListP nodeIds);
Clean (BEAddNodeIdsRefCounts :: Int BESymbolP BENodeIdListP BackEnd -> BackEnd)

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
310
311
312
313
314
315
BENodeP BESwitchNode (BENodeIdP nodeId, BEArgP caseNode);
Clean (BESwitchNode :: BENodeIdP BEArgP BackEnd -> (BENodeP, BackEnd))

BENodeP BECaseNode (int symbolArity, BESymbolP symbol, BENodeDefP nodeDefs, BEStrictNodeIdP strictNodeIds, BENodeP node);
Clean (BECaseNode :: Int BESymbolP BENodeDefP BEStrictNodeIdP BENodeP BackEnd -> (BENodeP, BackEnd))

316
317
318
319
320
321
void BEEnterLocalScope (void);
Clean (BEEnterLocalScope :: BackEnd -> BackEnd)

void BELeaveLocalScope (BENodeP node);
Clean (BELeaveLocalScope :: BENodeP BackEnd -> BackEnd)

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
322
323
324
325
326
327
BENodeP BEPushNode (int arity, BESymbolP symbol, BEArgP arguments, BENodeIdListP nodeIds);
Clean (BEPushNode :: Int BESymbolP BEArgP BENodeIdListP BackEnd -> (BENodeP, BackEnd))

BENodeP BEDefaultNode (BENodeDefP nodeDefs, BEStrictNodeIdP strictNodeIds, BENodeP node);
Clean (BEDefaultNode :: BENodeDefP BEStrictNodeIdP BENodeP BackEnd -> (BENodeP, BackEnd))

clean's avatar
clean committed
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
BENodeP BESelectorNode (BESelectorKind selectorKind, BESymbolP fieldSymbol, BEArgP args);
Clean (BESelectorNode :: BESelectorKind BESymbolP BEArgP BackEnd -> (BENodeP, BackEnd))

BENodeP BEUpdateNode (BEArgP args);
Clean (BEUpdateNode :: BEArgP BackEnd -> (BENodeP, BackEnd))

BENodeP BENodeIdNode (BENodeIdP nodeId, BEArgP args);
Clean (BENodeIdNode :: BENodeIdP BEArgP BackEnd -> (BENodeP, BackEnd))

BEArgP BENoArgs (void);
Clean (BENoArgs :: BackEnd -> (BEArgP, BackEnd))

BEArgP BEArgs (BENodeP node, BEArgP nextArgs);
Clean (BEArgs :: BENodeP BEArgP BackEnd -> (BEArgP, BackEnd))

BERuleAltP BERuleAlt (int line, BENodeDefP lhsDefs, BENodeP lhs, BENodeDefP rhsDefs, BEStrictNodeIdP lhsStrictNodeIds, BENodeP rhs);
Clean (BERuleAlt :: Int BENodeDefP BENodeP BENodeDefP BEStrictNodeIdP BENodeP BackEnd -> (BERuleAltP, BackEnd))

BERuleAltP BERuleAlts (BERuleAltP alt, BERuleAltP alts);
Clean (BERuleAlts :: BERuleAltP BERuleAltP BackEnd -> (BERuleAltP, BackEnd))

BERuleAltP BENoRuleAlts (void);
Clean (BENoRuleAlts :: BackEnd -> (BERuleAltP, BackEnd))

# define	BELhsNodeId	0
# define	BERhsNodeId	1
void BEDeclareNodeId (int sequenceNumber, int lhsOrRhs, CleanString name);
Clean (BEDeclareNodeId :: Int Int String BackEnd -> BackEnd)

BENodeIdP BENodeId (int sequenceNumber);
Clean (BENodeId :: Int BackEnd -> (BENodeIdP, BackEnd))

BENodeIdP BEWildCardNodeId (void);
Clean (BEWildCardNodeId :: BackEnd -> (BENodeIdP, BackEnd))

BENodeDefP BENodeDef (int sequenceNumber, BENodeP node);
Clean (BENodeDef :: Int BENodeP BackEnd -> (BENodeDefP, BackEnd))

BENodeDefP BENoNodeDefs (void);
Clean (BENoNodeDefs :: BackEnd -> (BENodeDefP, BackEnd))

BENodeDefP BENodeDefs (BENodeDefP nodeDef, BENodeDefP nodeDefs);
Clean (BENodeDefs :: BENodeDefP BENodeDefP BackEnd -> (BENodeDefP, BackEnd))

BEStrictNodeIdP BEStrictNodeId (BENodeIdP nodeId);
Clean (BEStrictNodeId :: BENodeIdP BackEnd -> (BEStrictNodeIdP, BackEnd))

BEStrictNodeIdP BENoStrictNodeIds (void);
Clean (BENoStrictNodeIds :: BackEnd -> (BEStrictNodeIdP, BackEnd))

BEStrictNodeIdP BEStrictNodeIds (BEStrictNodeIdP strictNodeId, BEStrictNodeIdP strictNodeIds);
Clean (BEStrictNodeIds :: BEStrictNodeIdP BEStrictNodeIdP BackEnd -> (BEStrictNodeIdP, BackEnd))

# define	BEIsNotACaf	0
# define	BEIsACaf	1
BEImpRuleP BERule (int functionIndex, int isCaf, BETypeAltP type, BERuleAltP alts);
Clean (BERule :: Int Int BETypeAltP BERuleAltP BackEnd -> (BEImpRuleP, BackEnd))

void BEDeclareRuleType (int functionIndex, int moduleIndex, CleanString name);
Clean (BEDeclareRuleType :: Int Int String BackEnd -> BackEnd)

void BEDefineRuleType (int functionIndex, int moduleIndex, BETypeAltP typeAlt);
Clean (BEDefineRuleType :: Int Int BETypeAltP BackEnd -> BackEnd)

void BEAdjustArrayFunction (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex);
Clean (BEAdjustArrayFunction :: BEArrayFunKind Int Int BackEnd -> BackEnd)

BEImpRuleP BENoRules (void);
Clean (BENoRules :: BackEnd -> (BEImpRuleP, BackEnd))

BEImpRuleP BERules (BEImpRuleP rule, BEImpRuleP rules);
Clean (BERules :: BEImpRuleP BEImpRuleP BackEnd -> (BEImpRuleP, BackEnd))

BETypeP BETypes (BETypeP type, BETypeP types);
Clean (BETypes :: BETypeP BETypeP BackEnd -> (BETypeP, BackEnd))

BETypeP BENoTypes (void);
Clean (BENoTypes :: BackEnd -> (BETypeP, BackEnd))

BEFlatTypeP BEFlatType (BESymbolP symbol, BETypeVarListP arguments);
Clean (BEFlatType :: BESymbolP BETypeVarListP BackEnd -> (BEFlatTypeP, BackEnd))

void BEAlgebraicType (BEFlatTypeP lhs, BEConstructorListP constructors);
Clean (BEAlgebraicType:: BEFlatTypeP BEConstructorListP BackEnd -> BackEnd)

void BERecordType (int moduleIndex, BEFlatTypeP lhs, BETypeNodeP constructorType, BEFieldListP fields);
Clean (BERecordType :: Int BEFlatTypeP BETypeNodeP BEFieldListP BackEnd -> BackEnd)

void BEAbsType (BEFlatTypeP lhs);
Clean (BEAbsType :: BEFlatTypeP BackEnd -> BackEnd)

BEConstructorListP BEConstructors (BEConstructorListP constructor, BEConstructorListP constructors);
Clean (BEConstructors:: BEConstructorListP BEConstructorListP BackEnd -> (BEConstructorListP, BackEnd))

BEConstructorListP BENoConstructors (void);
Clean (BENoConstructors:: BackEnd -> (BEConstructorListP, BackEnd))

BEConstructorListP BEConstructor (BETypeNodeP type);
Clean (BEConstructor:: BETypeNodeP BackEnd -> (BEConstructorListP, BackEnd))

void BEDeclareField (int fieldIndex, int moduleIndex, CleanString name);
Clean (BEDeclareField :: Int Int String BackEnd -> BackEnd)

BEFieldListP BEField (int fieldIndex, int moduleIndex, BETypeNodeP type);
Clean (BEField :: Int Int BETypeNodeP BackEnd -> (BEFieldListP, BackEnd))

BEFieldListP BEFields (BEFieldListP field, BEFieldListP fields);
Clean (BEFields:: BEFieldListP BEFieldListP BackEnd -> (BEFieldListP, BackEnd))

BEFieldListP BENoFields (void);
Clean (BENoFields:: BackEnd -> (BEFieldListP, BackEnd))

void BEDeclareConstructor (int constructorIndex, int moduleIndex, CleanString name);
Clean (BEDeclareConstructor:: Int Int String BackEnd -> BackEnd)

BETypeVarP BETypeVar (CleanString name);
Clean (BETypeVar:: String BackEnd -> (BETypeVarP, BackEnd))

void BEDeclareType (int typeIndex, int moduleIndex, CleanString name);
Clean (BEDeclareType:: Int Int String BackEnd -> BackEnd)

void BEDeclareFunction (CleanString name, int arity, int functionIndex, int ancestor);
Clean (BEDeclareFunction :: String Int Int Int BackEnd -> BackEnd)

BERuleAltP BECodeAlt (int line, BENodeDefP lhsDefs, BENodeP lhs, BECodeBlockP codeBlock);
Clean (BECodeAlt:: Int BENodeDefP BENodeP BECodeBlockP BackEnd -> (BERuleAltP, BackEnd))

BEStringListP BEString (CleanString cleanString);
Clean (BEString:: String BackEnd -> (BEStringListP, BackEnd))

BEStringListP BEStrings (BEStringListP string, BEStringListP strings);
Clean (BEStrings:: BEStringListP BEStringListP BackEnd -> (BEStringListP, BackEnd))

BEStringListP BENoStrings (void);
Clean (BENoStrings:: BackEnd -> (BEStringListP, BackEnd))

BECodeParameterP BECodeParameter (CleanString location, BENodeIdP nodeId);
Clean (BECodeParameter:: String BENodeIdP BackEnd -> (BECodeParameterP, BackEnd))

BECodeParameterP BECodeParameters (BECodeParameterP parameter, BECodeParameterP parameters);
Clean (BECodeParameters:: BECodeParameterP BECodeParameterP BackEnd -> (BECodeParameterP, BackEnd))

BECodeParameterP BENoCodeParameters (void);
Clean (BENoCodeParameters:: BackEnd -> (BECodeParameterP, BackEnd))

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
473
474
475
476
477
478
479
480
481
BENodeIdListP BENodeIdListElem (BENodeIdP nodeId);
Clean (BENodeIdListElem:: BENodeIdP BackEnd -> (BENodeIdListP, BackEnd))

BENodeIdListP BENodeIds (BENodeIdListP nid, BENodeIdListP nids);
Clean (BENodeIds:: BENodeIdListP BENodeIdListP BackEnd -> (BENodeIdListP, BackEnd))

BENodeIdListP BENoNodeIds (void);
Clean (BENoNodeIds:: BackEnd -> (BENodeIdListP, BackEnd))

clean's avatar
clean committed
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
BECodeBlockP BEAbcCodeBlock (int inline, BEStringListP instructions);
Clean (BEAbcCodeBlock:: Bool BEStringListP BackEnd -> (BECodeBlockP, BackEnd))

BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams, BECodeParameterP outParams, BEStringListP instructions);
Clean (BEAnyCodeBlock:: BECodeParameterP BECodeParameterP BEStringListP BackEnd -> (BECodeBlockP, BackEnd))

void BEDeclareIclModule (CleanString name, int nFunctions, int nTypes, int nConstructors, int nFields);
Clean (BEDeclareIclModule ::  String Int Int Int Int BackEnd -> BackEnd)

void BEDeclareDclModule (int moduleIndex, CleanString name, int systemModule, int nFunctions, int nTypes, int nConstructors, int nFields);
Clean (BEDeclareDclModule :: Int String Bool Int Int Int Int BackEnd -> BackEnd)

void BEDeclarePredefinedModule (int nTypes, int nConstructors);
Clean (BEDeclarePredefinedModule :: Int Int BackEnd -> BackEnd)

void BEDefineRules (BEImpRuleP rules);
Clean (BEDefineRules :: BEImpRuleP BackEnd -> BackEnd)

int BEGenerateCode (CleanString outputFile);
Clean (BEGenerateCode :: String BackEnd -> (Bool, BackEnd))

void BEExportType (int dclTypeIndex, int iclTypeIndex);
Clean (BEExportType :: Int Int BackEnd -> BackEnd)

void BESwapTypes (int frm, int to);
Clean (BESwapTypes :: Int Int BackEnd -> BackEnd)

void BEExportConstructor (int dclConstructorIndex, int iclConstructorIndex);
Clean (BEExportConstructor :: Int Int BackEnd -> BackEnd)

void BEExportField (int dclTypeIndex, int iclTypeIndex);
Clean (BEExportField :: Int Int BackEnd -> BackEnd)

void BEExportFunction (int dclFunctionIndex, int iclFunctionIndex);
Clean (BEExportFunction :: Int Int BackEnd -> BackEnd)

void BEDefineImportedObjsAndLibs (BEStringListP objs, BEStringListP libs);
Clean (BEDefineImportedObjsAndLibs :: BEStringListP BEStringListP BackEnd -> BackEnd)
520
521
522

void BESetMainDclModuleN (int main_dcl_module_n_parameter);
Clean (BESetMainDclModuleN :: Int BackEnd -> BackEnd)
523
524
525
526
527
528
529

// temporary hack
void BEDeclareDynamicTypeSymbol (int typeIndex, int moduleIndex);
Clean (BEDeclareDynamicTypeSymbol :: Int Int BackEnd -> BackEnd)

BESymbolP BEDynamicTempTypeSymbol (void);
Clean (BEDynamicTempTypeSymbol :: BackEnd -> (BESymbolP, BackEnd))