-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanf.yaml
More file actions
303 lines (273 loc) · 7.72 KB
/
Copy pathanf.yaml
File metadata and controls
303 lines (273 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
212
213
214
215
216
217
218
219
220
221
222
223
224
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
#
# CEKF - VM supporting amb
# Copyright (C) 2022-2025 Bill Hails
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
config:
name: anf
description: A-Normal Form (ANF) structures to be converted to bytecode.
parserInfo: true
includes:
- utils.h
limited_includes:
- bigint.h
- ast_helper.h
- tc.h
- tc_debug.h
structs:
AnfEnv:
meta:
brief: ANF Compile Time Environment
description: lookUp for the run-time locations of variables.
data:
isLocal: bool
isCapturing: bool = false
nBindings: int = 0
table: IntMap
next: AnfEnv
AexpLam:
meta:
brief: ANF Aexp Lambda
description: A lambda expression in ANF.
data:
nArgs: int
letRecOffset: int
args: AexpVarList
exp: AnfExp
AexpVarList:
meta:
brief: ANF Aexp Variable List
description: A list of argument variables for a lambda.
data:
var: HashSymbol
next: AexpVarList
AexpAnnotatedVar:
meta:
brief: ANF Annotated Variable
description: >-
A variable annotated with its location in the environment.
data:
type: AexpAnnotatedVarType
frame: int
offset: int
var: HashSymbol
AexpPrimApp:
meta:
brief: ANF Aexp Primitive Application
description: A primitive operation applied to two A-expressions.
data:
type: AexpPrimOp
exp1: Aexp
exp2: Aexp
AexpList:
meta:
brief: ANF Aexp List
description: A list of A-expressions.
data:
exp: Aexp
next: AexpList
AexpIntList:
meta:
brief: ANF Aexp Integer List
description: A list of integers used in ANF.
data:
integer: int
next: AexpIntList
AexpMakeVec:
meta:
brief: ANF Aexp Make Vector
description: A vector construction operation in ANF.
data:
nArgs: int
args: AexpList
CexpApply:
meta:
brief: ANF Cexp Apply
description: A application of a function in ANF.
data:
function: Aexp
nArgs: int
args: AexpList
CexpIf:
meta:
brief: ANF Cexp If
description: A conditional expression in ANF.
data:
condition: Aexp
consequent: AnfExp
alternative: AnfExp
CexpCond:
meta:
brief: ANF Cexp Conditional
description: A conditional expression with multiple cases in ANF.
data:
condition: Aexp
cases: CexpCondCases
CexpIntCondCases:
meta:
brief: ANF Cexp Integer Conditional Cases
description: >-
Sub-class of CexpCondCases for big integer dispatch tables in
ANF.
data:
option: MaybeBigInt
body: AnfExp
next: CexpIntCondCases
CexpCharCondCases:
meta:
brief: ANF Cexp Character Conditional Cases
description: >-
Sub-class of CexpCondCases for UTF-32 character dispatch tables
in ANF.
data:
option: character
body: AnfExp
next: CexpCharCondCases
CexpMatch:
meta:
brief: ANF Cexp Match
description: A match expression derived from a TPMC switch in ANF.
data:
condition: Aexp
clauses: AnfMatchList
CexpLetRec:
meta:
brief: ANF Cexp Let Rec
description: A let-rec (recursive let) expression in ANF.
data:
nBindings: int
bindings: AnfLetRecBindings
body: AnfExp
CexpAmb:
meta:
brief: ANF Cexp Amb
description: An amb operation in ANF.
data:
exp1: AnfExp
exp2: AnfExp
CexpCut:
meta:
brief: ANF Cexp Cut
description: A cut operation in ANF.
data:
exp: AnfExp
AnfExpLet:
data:
var: HashSymbol
val: AnfExp
body: AnfExp
AnfMatchList:
meta:
brief: ANF Match List
description: A list of expressions each with multiple match cases
data:
matches: AexpIntList
body: AnfExp
next: AnfMatchList
AnfLetRecBindings:
meta:
brief: ANF Let Rec Bindings
description: A list of let-rec (recursive let) bindings in ANF.
data:
var: HashSymbol
val: Aexp
next: AnfLetRecBindings
unions:
CexpCondCases:
meta:
brief: ANF Cexp Conditional Cases
description: A union of conditional cases for CexpCond, either character or
integer.
data:
charCases: CexpCharCondCases
intCases: CexpIntCondCases
Aexp:
meta:
brief: ANF Aexp
description: A union of all A-expressions (atomic expressions) in ANF.
data:
lam: AexpLam
var: HashSymbol
annotatedVar: AexpAnnotatedVar
bigInteger: MaybeBigInt
littleInteger: int
character: character
prim: AexpPrimApp
makeVec: AexpMakeVec
Cexp:
meta:
brief: ANF Cexp
description: A union of all C-expressions (complex expressions) in ANF.
data:
back: void_ptr
error: void_ptr
apply: CexpApply
iff: CexpIf
cond: CexpCond
callCC: Aexp
letRec: CexpLetRec
amb: CexpAmb
cut: CexpCut
match: CexpMatch
AnfExp:
meta:
brief: ANF Exp
description: A union of all expression types (atomic or complex) in ANF.
data:
done: void_ptr
aexp: Aexp
cexp: Cexp
let: AnfExpLet
enums:
AexpAnnotatedVarType:
meta:
brief: ANF Aexp Annotated Variable Type
description: The type (i.e. location) of an annotated variable in ANF.
data:
- STACK
- ENV
AexpPrimOp:
meta:
brief: ANF Aexp Primitive Operation types.
description: The type of all primitive operations in ANF.
data:
- ADD
- SUB
- MUL
- DIV
- GCD
- LCM
- CANON
- POW
- EQ
- NE
- LT
- GT
- LE
- GE
- VEC
- MOD
- CMP
arrays:
AnfEnvArray:
meta:
brief: ANF Compile Time Environment Array
description: An array of compile time environments in ANF.
data:
entries: AnfEnv
primitives: !include primitives.yaml
external:
- !include utils.yaml
- !include tc.yaml