@oseo/backend-c 0.0.0-stage → 0.1.0-canary.370
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/MIT-LICENSE.txt +21 -0
- package/README.md +58 -2
- package/dist/bounded-body.d.ts +28 -0
- package/dist/bounded-body.d.ts.map +1 -0
- package/dist/bounded-body.js +198 -0
- package/dist/bounded-body.js.map +1 -0
- package/dist/emitted-c.d.ts +676 -0
- package/dist/emitted-c.d.ts.map +1 -0
- package/dist/emitted-c.js +1331 -0
- package/dist/emitted-c.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2282 -0
- package/dist/index.js.map +1 -0
- package/dist/regexp-program.d.ts +64 -0
- package/dist/regexp-program.d.ts.map +1 -0
- package/dist/regexp-program.js +357 -0
- package/dist/regexp-program.js.map +1 -0
- package/package.json +36 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RegExpMatcherProgram } from "@oseo/compiler";
|
|
2
|
+
//#region src/regexp-program.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The C encoding of one ahead-of-time compiled regular expression
|
|
5
|
+
* literal.
|
|
6
|
+
*
|
|
7
|
+
* The runtime's matcher executes a flat instruction array over a register
|
|
8
|
+
* file, so this is the same program `@oseo/compiler` built, written in the
|
|
9
|
+
* generated-code ABI's layout. Nothing here decides matching behavior: an
|
|
10
|
+
* encoding that changed choice order, capture visibility, or set contents
|
|
11
|
+
* would make the literal path disagree with the semantic authority.
|
|
12
|
+
*/
|
|
13
|
+
interface EncodedRegExpProgram {
|
|
14
|
+
readonly captures: readonly EncodedRegExpCapture[];
|
|
15
|
+
readonly canonicalCharacters: readonly number[];
|
|
16
|
+
readonly canonicalValues: readonly number[];
|
|
17
|
+
readonly flagMask: number;
|
|
18
|
+
readonly flagUnits: readonly number[];
|
|
19
|
+
readonly hasGroupNames: boolean;
|
|
20
|
+
readonly ignoreCase: boolean;
|
|
21
|
+
readonly instructions: readonly EncodedRegExpInstruction[];
|
|
22
|
+
readonly nameUnits: readonly number[];
|
|
23
|
+
readonly registers: number;
|
|
24
|
+
readonly repeats: readonly EncodedRegExpRepeat[];
|
|
25
|
+
readonly setBoundaries: readonly number[];
|
|
26
|
+
readonly setOffsets: readonly number[];
|
|
27
|
+
readonly sourceUnits: readonly number[];
|
|
28
|
+
readonly unicodeMode: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** One encoded instruction with its four uniform operands. */
|
|
31
|
+
interface EncodedRegExpInstruction {
|
|
32
|
+
readonly modifiers: number;
|
|
33
|
+
readonly opcode: number;
|
|
34
|
+
readonly operands: readonly [number, number, number, number];
|
|
35
|
+
}
|
|
36
|
+
/** One quantifier's repetition metadata, held out of line. */
|
|
37
|
+
interface EncodedRegExpRepeat {
|
|
38
|
+
readonly clearFrom: number;
|
|
39
|
+
readonly clearTo: number;
|
|
40
|
+
/** `undefined` for an unbounded repetition, which the ABI writes as
|
|
41
|
+
* the largest `uint64_t`. */
|
|
42
|
+
readonly maximum: number | undefined;
|
|
43
|
+
readonly minimum: number;
|
|
44
|
+
}
|
|
45
|
+
/** One capturing group's optional name, as a span of the name units. */
|
|
46
|
+
interface EncodedRegExpCapture {
|
|
47
|
+
readonly nameLength: number;
|
|
48
|
+
readonly nameOffset: number;
|
|
49
|
+
readonly named: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Encode one matcher artifact in the generated-code ABI's layout.
|
|
53
|
+
*
|
|
54
|
+
* The artifact addresses its own instructions by position, and a
|
|
55
|
+
* backreference to a duplicated group name expands to one encoded
|
|
56
|
+
* instruction per candidate, so every branch target is remapped through
|
|
57
|
+
* the encoded addresses rather than copied. The artifact builder charges
|
|
58
|
+
* that expansion against its reviewed instruction limit, so the encoded
|
|
59
|
+
* program is bounded by the same limit the artifact is.
|
|
60
|
+
*/
|
|
61
|
+
declare function encodeRegExpProgram(program: RegExpMatcherProgram): EncodedRegExpProgram;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { EncodedRegExpCapture, EncodedRegExpInstruction, EncodedRegExpProgram, EncodedRegExpRepeat, encodeRegExpProgram };
|
|
64
|
+
//# sourceMappingURL=regexp-program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regexp-program.d.ts","names":[],"sources":["../src/regexp-program.ts"],"mappings":";;;;;;;;;;;;UAwCiB;WACN,mBAAmB;WACnB;WACA;WACA;WACA;WACA;WACA;WACA,uBAAuB;WACvB;WACA;WACA,kBAAkB;WAClB;WACA;WACA;WACA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN;WACA;;;WAGA;WACA;;;UAIM;WACN;WACA;WACA;;;;;;;;;;;;iBA6WK,oBACd,SAAS,uBACR"}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
//#region src/regexp-program.ts
|
|
2
|
+
/** The opcode numbers the runtime's matcher dispatches on. */
|
|
3
|
+
const opcodes = {
|
|
4
|
+
accept: 0,
|
|
5
|
+
backreference: 14,
|
|
6
|
+
boundary: 4,
|
|
7
|
+
consume: 2,
|
|
8
|
+
edge: 3,
|
|
9
|
+
fail: 1,
|
|
10
|
+
fork: 6,
|
|
11
|
+
jump: 7,
|
|
12
|
+
lookEnd: 13,
|
|
13
|
+
lookStart: 12,
|
|
14
|
+
repeat: 8,
|
|
15
|
+
repeatEnd: 11,
|
|
16
|
+
repeatEnter: 10,
|
|
17
|
+
repeatInit: 9,
|
|
18
|
+
save: 5
|
|
19
|
+
};
|
|
20
|
+
/** The per-instruction modifier bits the runtime's matcher reads. */
|
|
21
|
+
const modifiers = {
|
|
22
|
+
backward: 1,
|
|
23
|
+
endEdge: 32,
|
|
24
|
+
greedy: 4,
|
|
25
|
+
ignoreCase: 16,
|
|
26
|
+
multiline: 8,
|
|
27
|
+
negated: 2
|
|
28
|
+
};
|
|
29
|
+
/** The normalized flag bits the runtime decodes every accessor from. */
|
|
30
|
+
const flagBits = {
|
|
31
|
+
dotAll: 16,
|
|
32
|
+
global: 2,
|
|
33
|
+
hasIndices: 1,
|
|
34
|
+
ignoreCase: 4,
|
|
35
|
+
multiline: 8,
|
|
36
|
+
sticky: 128,
|
|
37
|
+
unicode: 32,
|
|
38
|
+
unicodeSets: 64
|
|
39
|
+
};
|
|
40
|
+
function fail(message) {
|
|
41
|
+
throw new Error(`A regular expression literal ${message}`);
|
|
42
|
+
}
|
|
43
|
+
/** The UTF-16 code units of one string, as the ABI stores text. */
|
|
44
|
+
function utf16(value) {
|
|
45
|
+
const units = [];
|
|
46
|
+
for (let index = 0; index < value.length; index += 1) units.push(value.charCodeAt(index));
|
|
47
|
+
return units;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* How many encoded instructions one artifact instruction becomes.
|
|
51
|
+
*
|
|
52
|
+
* Every instruction is one instruction except a backreference to a
|
|
53
|
+
* duplicated group name, which the ABI writes as one instruction per
|
|
54
|
+
* candidate capture. At most one of them can have participated in the
|
|
55
|
+
* match, and a slot that did not participate matches the empty string, so
|
|
56
|
+
* running the candidates in order resolves the same capture the artifact
|
|
57
|
+
* selects.
|
|
58
|
+
*/
|
|
59
|
+
function encodedWidth(instruction) {
|
|
60
|
+
if (instruction.kind !== "backreference") return 1;
|
|
61
|
+
if (instruction.slots.length === 0) fail("holds a backreference that names no capture.");
|
|
62
|
+
return instruction.slots.length;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Collect one repetition record per quantifier.
|
|
66
|
+
*
|
|
67
|
+
* A quantifier allocates its own counter register, so the counter is what
|
|
68
|
+
* identifies the `repeat`, `repeat-enter`, and `repeat-end` instructions
|
|
69
|
+
* of one repetition. The bounds live on the decision instruction and the
|
|
70
|
+
* capture range each iteration clears lives on the entry instruction, so
|
|
71
|
+
* the record is complete only after both were seen.
|
|
72
|
+
*/
|
|
73
|
+
function collectRepeats(program) {
|
|
74
|
+
const indices = /* @__PURE__ */ new Map();
|
|
75
|
+
const records = [];
|
|
76
|
+
const recordFor = (counter) => {
|
|
77
|
+
const existing = indices.get(counter);
|
|
78
|
+
if (existing != null) {
|
|
79
|
+
const found = records[existing];
|
|
80
|
+
if (found == null) fail("numbers its repetitions inconsistently.");
|
|
81
|
+
return found;
|
|
82
|
+
}
|
|
83
|
+
const record = {
|
|
84
|
+
clearFrom: 0,
|
|
85
|
+
clearTo: 0,
|
|
86
|
+
maximum: 0,
|
|
87
|
+
minimum: 0
|
|
88
|
+
};
|
|
89
|
+
indices.set(counter, records.length);
|
|
90
|
+
records.push(record);
|
|
91
|
+
return record;
|
|
92
|
+
};
|
|
93
|
+
for (const instruction of program.instructions) if (instruction.kind === "repeat") {
|
|
94
|
+
const record = recordFor(instruction.counter);
|
|
95
|
+
record.minimum = instruction.minimum;
|
|
96
|
+
record.maximum = Number.isFinite(instruction.maximum) ? instruction.maximum : void 0;
|
|
97
|
+
} else if (instruction.kind === "repeat-enter") {
|
|
98
|
+
const record = recordFor(instruction.counter);
|
|
99
|
+
record.clearFrom = instruction.clearFrom;
|
|
100
|
+
record.clearTo = instruction.clearTo;
|
|
101
|
+
} else if (instruction.kind === "repeat-init" || instruction.kind === "repeat-end") recordFor(instruction.counter);
|
|
102
|
+
return {
|
|
103
|
+
indices,
|
|
104
|
+
records
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function repeatIndex(indices, counter) {
|
|
108
|
+
const index = indices.get(counter);
|
|
109
|
+
if (index == null) fail("refers to a repetition it never begins.");
|
|
110
|
+
return index;
|
|
111
|
+
}
|
|
112
|
+
function encodeInstruction(instruction, addresses, repeats) {
|
|
113
|
+
const address = (target) => {
|
|
114
|
+
const resolved = addresses[target];
|
|
115
|
+
if (resolved == null) fail("jumps outside its own instructions.");
|
|
116
|
+
return resolved;
|
|
117
|
+
};
|
|
118
|
+
if (instruction.kind === "accept") return [{
|
|
119
|
+
modifiers: 0,
|
|
120
|
+
opcode: opcodes.accept,
|
|
121
|
+
operands: [
|
|
122
|
+
0,
|
|
123
|
+
0,
|
|
124
|
+
0,
|
|
125
|
+
0
|
|
126
|
+
]
|
|
127
|
+
}];
|
|
128
|
+
if (instruction.kind === "fail") return [{
|
|
129
|
+
modifiers: 0,
|
|
130
|
+
opcode: opcodes.fail,
|
|
131
|
+
operands: [
|
|
132
|
+
0,
|
|
133
|
+
0,
|
|
134
|
+
0,
|
|
135
|
+
0
|
|
136
|
+
]
|
|
137
|
+
}];
|
|
138
|
+
if (instruction.kind === "consume") return [{
|
|
139
|
+
modifiers: instruction.backward ? modifiers.backward : 0,
|
|
140
|
+
opcode: opcodes.consume,
|
|
141
|
+
operands: [
|
|
142
|
+
instruction.set,
|
|
143
|
+
0,
|
|
144
|
+
0,
|
|
145
|
+
0
|
|
146
|
+
]
|
|
147
|
+
}];
|
|
148
|
+
if (instruction.kind === "edge") return [{
|
|
149
|
+
modifiers: (instruction.assertion === "end" ? modifiers.endEdge : 0) | (instruction.multiline ? modifiers.multiline : 0),
|
|
150
|
+
opcode: opcodes.edge,
|
|
151
|
+
operands: [
|
|
152
|
+
0,
|
|
153
|
+
0,
|
|
154
|
+
0,
|
|
155
|
+
0
|
|
156
|
+
]
|
|
157
|
+
}];
|
|
158
|
+
if (instruction.kind === "boundary") return [{
|
|
159
|
+
modifiers: instruction.negated ? modifiers.negated : 0,
|
|
160
|
+
opcode: opcodes.boundary,
|
|
161
|
+
operands: [
|
|
162
|
+
instruction.set,
|
|
163
|
+
0,
|
|
164
|
+
0,
|
|
165
|
+
0
|
|
166
|
+
]
|
|
167
|
+
}];
|
|
168
|
+
if (instruction.kind === "save") return [{
|
|
169
|
+
modifiers: 0,
|
|
170
|
+
opcode: opcodes.save,
|
|
171
|
+
operands: [
|
|
172
|
+
instruction.slot,
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
0
|
|
176
|
+
]
|
|
177
|
+
}];
|
|
178
|
+
if (instruction.kind === "fork") return [{
|
|
179
|
+
modifiers: 0,
|
|
180
|
+
opcode: opcodes.fork,
|
|
181
|
+
operands: [
|
|
182
|
+
address(instruction.preferred),
|
|
183
|
+
address(instruction.alternative),
|
|
184
|
+
0,
|
|
185
|
+
0
|
|
186
|
+
]
|
|
187
|
+
}];
|
|
188
|
+
if (instruction.kind === "jump") return [{
|
|
189
|
+
modifiers: 0,
|
|
190
|
+
opcode: opcodes.jump,
|
|
191
|
+
operands: [
|
|
192
|
+
address(instruction.target),
|
|
193
|
+
0,
|
|
194
|
+
0,
|
|
195
|
+
0
|
|
196
|
+
]
|
|
197
|
+
}];
|
|
198
|
+
if (instruction.kind === "repeat") return [{
|
|
199
|
+
modifiers: instruction.greedy ? modifiers.greedy : 0,
|
|
200
|
+
opcode: opcodes.repeat,
|
|
201
|
+
operands: [
|
|
202
|
+
instruction.counter,
|
|
203
|
+
address(instruction.enter),
|
|
204
|
+
address(instruction.exit),
|
|
205
|
+
repeatIndex(repeats, instruction.counter)
|
|
206
|
+
]
|
|
207
|
+
}];
|
|
208
|
+
if (instruction.kind === "repeat-init") return [{
|
|
209
|
+
modifiers: 0,
|
|
210
|
+
opcode: opcodes.repeatInit,
|
|
211
|
+
operands: [
|
|
212
|
+
instruction.counter,
|
|
213
|
+
0,
|
|
214
|
+
0,
|
|
215
|
+
0
|
|
216
|
+
]
|
|
217
|
+
}];
|
|
218
|
+
if (instruction.kind === "repeat-enter") return [{
|
|
219
|
+
modifiers: 0,
|
|
220
|
+
opcode: opcodes.repeatEnter,
|
|
221
|
+
operands: [
|
|
222
|
+
instruction.counter,
|
|
223
|
+
instruction.position,
|
|
224
|
+
address(instruction.body),
|
|
225
|
+
repeatIndex(repeats, instruction.counter)
|
|
226
|
+
]
|
|
227
|
+
}];
|
|
228
|
+
if (instruction.kind === "repeat-end") return [{
|
|
229
|
+
modifiers: 0,
|
|
230
|
+
opcode: opcodes.repeatEnd,
|
|
231
|
+
operands: [
|
|
232
|
+
instruction.counter,
|
|
233
|
+
address(instruction.head),
|
|
234
|
+
instruction.position,
|
|
235
|
+
repeatIndex(repeats, instruction.counter)
|
|
236
|
+
]
|
|
237
|
+
}];
|
|
238
|
+
if (instruction.kind === "look-start") return [{
|
|
239
|
+
modifiers: 0,
|
|
240
|
+
opcode: opcodes.lookStart,
|
|
241
|
+
operands: [
|
|
242
|
+
instruction.frame,
|
|
243
|
+
address(instruction.body),
|
|
244
|
+
address(instruction.onFail),
|
|
245
|
+
0
|
|
246
|
+
]
|
|
247
|
+
}];
|
|
248
|
+
if (instruction.kind === "look-end") return [{
|
|
249
|
+
modifiers: instruction.negated ? modifiers.negated : 0,
|
|
250
|
+
opcode: opcodes.lookEnd,
|
|
251
|
+
operands: [
|
|
252
|
+
instruction.frame,
|
|
253
|
+
address(instruction.exit),
|
|
254
|
+
0,
|
|
255
|
+
0
|
|
256
|
+
]
|
|
257
|
+
}];
|
|
258
|
+
if (instruction.kind === "backreference") {
|
|
259
|
+
const bits = (instruction.backward ? modifiers.backward : 0) | (instruction.ignoreCase ? modifiers.ignoreCase : 0);
|
|
260
|
+
return instruction.slots.map((slot) => ({
|
|
261
|
+
modifiers: bits,
|
|
262
|
+
opcode: opcodes.backreference,
|
|
263
|
+
operands: [
|
|
264
|
+
slot,
|
|
265
|
+
0,
|
|
266
|
+
0,
|
|
267
|
+
0
|
|
268
|
+
]
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
fail(`uses the ${instruction.kind} instruction, which has no C encoding.`);
|
|
272
|
+
}
|
|
273
|
+
function encodeCaptures(program) {
|
|
274
|
+
const captures = [];
|
|
275
|
+
const nameUnits = [];
|
|
276
|
+
for (let index = 0; index < program.captures.length; index += 1) captures.push({
|
|
277
|
+
nameLength: 0,
|
|
278
|
+
nameOffset: 0,
|
|
279
|
+
named: false
|
|
280
|
+
});
|
|
281
|
+
for (const capture of program.captures) {
|
|
282
|
+
const slot = capture.index - 1;
|
|
283
|
+
if (slot < 0 || slot >= captures.length) fail("numbers a capturing group outside its own capture list.");
|
|
284
|
+
if (capture.name == null) continue;
|
|
285
|
+
const units = utf16(capture.name);
|
|
286
|
+
captures[slot] = {
|
|
287
|
+
nameLength: units.length,
|
|
288
|
+
nameOffset: nameUnits.length,
|
|
289
|
+
named: true
|
|
290
|
+
};
|
|
291
|
+
nameUnits.push(...units);
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
captures,
|
|
295
|
+
nameUnits
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function flagMask(program) {
|
|
299
|
+
const flags = program.flags;
|
|
300
|
+
return (flags.hasIndices ? flagBits.hasIndices : 0) | (flags.global ? flagBits.global : 0) | (flags.ignoreCase ? flagBits.ignoreCase : 0) | (flags.multiline ? flagBits.multiline : 0) | (flags.dotAll ? flagBits.dotAll : 0) | (flags.unicode ? flagBits.unicode : 0) | (flags.unicodeSets ? flagBits.unicodeSets : 0) | (flags.sticky ? flagBits.sticky : 0);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Encode one matcher artifact in the generated-code ABI's layout.
|
|
304
|
+
*
|
|
305
|
+
* The artifact addresses its own instructions by position, and a
|
|
306
|
+
* backreference to a duplicated group name expands to one encoded
|
|
307
|
+
* instruction per candidate, so every branch target is remapped through
|
|
308
|
+
* the encoded addresses rather than copied. The artifact builder charges
|
|
309
|
+
* that expansion against its reviewed instruction limit, so the encoded
|
|
310
|
+
* program is bounded by the same limit the artifact is.
|
|
311
|
+
*/
|
|
312
|
+
function encodeRegExpProgram(program) {
|
|
313
|
+
const addresses = [];
|
|
314
|
+
let next = 0;
|
|
315
|
+
for (const instruction of program.instructions) {
|
|
316
|
+
addresses.push(next);
|
|
317
|
+
next += encodedWidth(instruction);
|
|
318
|
+
}
|
|
319
|
+
const repeats = collectRepeats(program);
|
|
320
|
+
const instructions = [];
|
|
321
|
+
for (const instruction of program.instructions) instructions.push(...encodeInstruction(instruction, addresses, repeats.indices));
|
|
322
|
+
const setBoundaries = [];
|
|
323
|
+
const setOffsets = [];
|
|
324
|
+
for (const set of program.sets) {
|
|
325
|
+
setOffsets.push(setBoundaries.length);
|
|
326
|
+
setBoundaries.push(...set);
|
|
327
|
+
}
|
|
328
|
+
setOffsets.push(setBoundaries.length);
|
|
329
|
+
const { captures, nameUnits } = encodeCaptures(program);
|
|
330
|
+
const table = program.canonicalization;
|
|
331
|
+
return {
|
|
332
|
+
canonicalCharacters: table == null ? [] : [...table.characters],
|
|
333
|
+
canonicalValues: table == null ? [] : [...table.canonical],
|
|
334
|
+
captures,
|
|
335
|
+
flagMask: flagMask(program),
|
|
336
|
+
flagUnits: utf16(program.flags.text),
|
|
337
|
+
hasGroupNames: captures.some((capture) => capture.named),
|
|
338
|
+
ignoreCase: program.flags.ignoreCase,
|
|
339
|
+
instructions,
|
|
340
|
+
nameUnits,
|
|
341
|
+
registers: program.registers,
|
|
342
|
+
repeats: repeats.records.map((record) => ({
|
|
343
|
+
clearFrom: record.clearFrom,
|
|
344
|
+
clearTo: record.clearTo,
|
|
345
|
+
maximum: record.maximum,
|
|
346
|
+
minimum: record.minimum
|
|
347
|
+
})),
|
|
348
|
+
setBoundaries,
|
|
349
|
+
setOffsets,
|
|
350
|
+
sourceUnits: utf16(program.source),
|
|
351
|
+
unicodeMode: program.unicodeMode
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
//#endregion
|
|
356
|
+
export { encodeRegExpProgram };
|
|
357
|
+
//# sourceMappingURL=regexp-program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regexp-program.js","names":[],"sources":["../src/regexp-program.ts"],"sourcesContent":["/*\n * Oseo, an ahead-of-time compiler for JavaScript and TypeScript.\n * Copyright (C) 2026 Hong Minhee <https://hongminhee.org/>\n *\n * The fixed C templates incorporated into compiled programs are under\n * the MIT license. The GPL notice covers the surrounding code. See\n * docs/runtime-support-surface.md for the licensing boundary.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n// Fixed C output templates in this file are MIT (../MIT-LICENSE.txt).\n// Compiler logic is GPL-3.0-or-later (../LICENSE).\n\nimport type {\n RegExpMatcherInstruction,\n RegExpMatcherProgram,\n} from \"@oseo/compiler\";\n\n/**\n * The C encoding of one ahead-of-time compiled regular expression\n * literal.\n *\n * The runtime's matcher executes a flat instruction array over a register\n * file, so this is the same program `@oseo/compiler` built, written in the\n * generated-code ABI's layout. Nothing here decides matching behavior: an\n * encoding that changed choice order, capture visibility, or set contents\n * would make the literal path disagree with the semantic authority.\n */\nexport interface EncodedRegExpProgram {\n readonly captures: readonly EncodedRegExpCapture[];\n readonly canonicalCharacters: readonly number[];\n readonly canonicalValues: readonly number[];\n readonly flagMask: number;\n readonly flagUnits: readonly number[];\n readonly hasGroupNames: boolean;\n readonly ignoreCase: boolean;\n readonly instructions: readonly EncodedRegExpInstruction[];\n readonly nameUnits: readonly number[];\n readonly registers: number;\n readonly repeats: readonly EncodedRegExpRepeat[];\n readonly setBoundaries: readonly number[];\n readonly setOffsets: readonly number[];\n readonly sourceUnits: readonly number[];\n readonly unicodeMode: boolean;\n}\n\n/** One encoded instruction with its four uniform operands. */\nexport interface EncodedRegExpInstruction {\n readonly modifiers: number;\n readonly opcode: number;\n readonly operands: readonly [number, number, number, number];\n}\n\n/** One quantifier's repetition metadata, held out of line. */\nexport interface EncodedRegExpRepeat {\n readonly clearFrom: number;\n readonly clearTo: number;\n /** `undefined` for an unbounded repetition, which the ABI writes as\n * the largest `uint64_t`. */\n readonly maximum: number | undefined;\n readonly minimum: number;\n}\n\n/** One capturing group's optional name, as a span of the name units. */\nexport interface EncodedRegExpCapture {\n readonly nameLength: number;\n readonly nameOffset: number;\n readonly named: boolean;\n}\n\n/** The opcode numbers the runtime's matcher dispatches on. */\nconst opcodes = {\n accept: 0,\n backreference: 14,\n boundary: 4,\n consume: 2,\n edge: 3,\n fail: 1,\n fork: 6,\n jump: 7,\n lookEnd: 13,\n lookStart: 12,\n repeat: 8,\n repeatEnd: 11,\n repeatEnter: 10,\n repeatInit: 9,\n save: 5,\n} as const;\n\n/** The per-instruction modifier bits the runtime's matcher reads. */\nconst modifiers = {\n backward: 0x01,\n endEdge: 0x20,\n greedy: 0x04,\n ignoreCase: 0x10,\n multiline: 0x08,\n negated: 0x02,\n} as const;\n\n/** The normalized flag bits the runtime decodes every accessor from. */\nconst flagBits = {\n dotAll: 1 << 4,\n global: 1 << 1,\n hasIndices: 1 << 0,\n ignoreCase: 1 << 2,\n multiline: 1 << 3,\n sticky: 1 << 7,\n unicode: 1 << 5,\n unicodeSets: 1 << 6,\n} as const;\n\n/** The mutable repetition record collected from one quantifier's triple. */\ninterface RepeatDraft {\n clearFrom: number;\n clearTo: number;\n maximum: number | undefined;\n minimum: number;\n}\n\nfunction fail(message: string): never {\n throw new Error(`A regular expression literal ${message}`);\n}\n\n/** The UTF-16 code units of one string, as the ABI stores text. */\nfunction utf16(value: string): readonly number[] {\n const units: number[] = [];\n for (let index = 0; index < value.length; index += 1) {\n units.push(value.charCodeAt(index));\n }\n return units;\n}\n\n/**\n * How many encoded instructions one artifact instruction becomes.\n *\n * Every instruction is one instruction except a backreference to a\n * duplicated group name, which the ABI writes as one instruction per\n * candidate capture. At most one of them can have participated in the\n * match, and a slot that did not participate matches the empty string, so\n * running the candidates in order resolves the same capture the artifact\n * selects.\n */\nfunction encodedWidth(instruction: RegExpMatcherInstruction): number {\n if (instruction.kind !== \"backreference\") return 1;\n if (instruction.slots.length === 0) {\n fail(\"holds a backreference that names no capture.\");\n }\n return instruction.slots.length;\n}\n\n/** The repetition table of one artifact and the counter it indexes by. */\ninterface RepeatTable {\n readonly indices: ReadonlyMap<number, number>;\n readonly records: readonly RepeatDraft[];\n}\n\n/**\n * Collect one repetition record per quantifier.\n *\n * A quantifier allocates its own counter register, so the counter is what\n * identifies the `repeat`, `repeat-enter`, and `repeat-end` instructions\n * of one repetition. The bounds live on the decision instruction and the\n * capture range each iteration clears lives on the entry instruction, so\n * the record is complete only after both were seen.\n */\nfunction collectRepeats(program: RegExpMatcherProgram): RepeatTable {\n const indices = new Map<number, number>();\n const records: RepeatDraft[] = [];\n const recordFor = (counter: number): RepeatDraft => {\n const existing = indices.get(counter);\n if (existing != null) {\n const found = records[existing];\n if (found == null) fail(\"numbers its repetitions inconsistently.\");\n return found;\n }\n const record: RepeatDraft = {\n clearFrom: 0,\n clearTo: 0,\n maximum: 0,\n minimum: 0,\n };\n indices.set(counter, records.length);\n records.push(record);\n return record;\n };\n for (const instruction of program.instructions) {\n if (instruction.kind === \"repeat\") {\n const record = recordFor(instruction.counter);\n record.minimum = instruction.minimum;\n record.maximum = Number.isFinite(instruction.maximum)\n ? instruction.maximum\n : undefined;\n } else if (instruction.kind === \"repeat-enter\") {\n const record = recordFor(instruction.counter);\n record.clearFrom = instruction.clearFrom;\n record.clearTo = instruction.clearTo;\n } else if (\n instruction.kind === \"repeat-init\" ||\n instruction.kind === \"repeat-end\"\n ) {\n recordFor(instruction.counter);\n }\n }\n return { indices, records };\n}\n\nfunction repeatIndex(\n indices: ReadonlyMap<number, number>,\n counter: number,\n): number {\n const index = indices.get(counter);\n if (index == null) fail(\"refers to a repetition it never begins.\");\n return index;\n}\n\nfunction encodeInstruction(\n instruction: RegExpMatcherInstruction,\n addresses: readonly number[],\n repeats: ReadonlyMap<number, number>,\n): readonly EncodedRegExpInstruction[] {\n const address = (target: number): number => {\n const resolved = addresses[target];\n if (resolved == null) fail(\"jumps outside its own instructions.\");\n return resolved;\n };\n if (instruction.kind === \"accept\") {\n return [{ modifiers: 0, opcode: opcodes.accept, operands: [0, 0, 0, 0] }];\n }\n if (instruction.kind === \"fail\") {\n return [{ modifiers: 0, opcode: opcodes.fail, operands: [0, 0, 0, 0] }];\n }\n if (instruction.kind === \"consume\") {\n return [\n {\n modifiers: instruction.backward ? modifiers.backward : 0,\n opcode: opcodes.consume,\n operands: [instruction.set, 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"edge\") {\n return [\n {\n modifiers:\n (instruction.assertion === \"end\" ? modifiers.endEdge : 0) |\n (instruction.multiline ? modifiers.multiline : 0),\n opcode: opcodes.edge,\n operands: [0, 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"boundary\") {\n return [\n {\n modifiers: instruction.negated ? modifiers.negated : 0,\n opcode: opcodes.boundary,\n operands: [instruction.set, 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"save\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.save,\n operands: [instruction.slot, 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"fork\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.fork,\n operands: [\n address(instruction.preferred),\n address(instruction.alternative),\n 0,\n 0,\n ],\n },\n ];\n }\n if (instruction.kind === \"jump\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.jump,\n operands: [address(instruction.target), 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"repeat\") {\n return [\n {\n modifiers: instruction.greedy ? modifiers.greedy : 0,\n opcode: opcodes.repeat,\n operands: [\n instruction.counter,\n address(instruction.enter),\n address(instruction.exit),\n repeatIndex(repeats, instruction.counter),\n ],\n },\n ];\n }\n if (instruction.kind === \"repeat-init\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.repeatInit,\n operands: [instruction.counter, 0, 0, 0],\n },\n ];\n }\n if (instruction.kind === \"repeat-enter\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.repeatEnter,\n operands: [\n instruction.counter,\n instruction.position,\n address(instruction.body),\n repeatIndex(repeats, instruction.counter),\n ],\n },\n ];\n }\n if (instruction.kind === \"repeat-end\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.repeatEnd,\n operands: [\n instruction.counter,\n address(instruction.head),\n instruction.position,\n repeatIndex(repeats, instruction.counter),\n ],\n },\n ];\n }\n if (instruction.kind === \"look-start\") {\n return [\n {\n modifiers: 0,\n opcode: opcodes.lookStart,\n operands: [\n instruction.frame,\n address(instruction.body),\n address(instruction.onFail),\n 0,\n ],\n },\n ];\n }\n if (instruction.kind === \"look-end\") {\n return [\n {\n modifiers: instruction.negated ? modifiers.negated : 0,\n opcode: opcodes.lookEnd,\n operands: [instruction.frame, address(instruction.exit), 0, 0],\n },\n ];\n }\n if (instruction.kind === \"backreference\") {\n const bits =\n (instruction.backward ? modifiers.backward : 0) |\n (instruction.ignoreCase ? modifiers.ignoreCase : 0);\n return instruction.slots.map((slot) => ({\n modifiers: bits,\n opcode: opcodes.backreference,\n operands: [slot, 0, 0, 0] as const,\n }));\n }\n fail(`uses the ${instruction.kind} instruction, which has no C encoding.`);\n}\n\n/** The capture table of one artifact and the names it spans. */\ninterface EncodedCaptureTable {\n readonly captures: readonly EncodedRegExpCapture[];\n readonly nameUnits: readonly number[];\n}\n\nfunction encodeCaptures(program: RegExpMatcherProgram): EncodedCaptureTable {\n const captures: EncodedRegExpCapture[] = [];\n const nameUnits: number[] = [];\n for (let index = 0; index < program.captures.length; index += 1) {\n captures.push({ nameLength: 0, nameOffset: 0, named: false });\n }\n for (const capture of program.captures) {\n const slot = capture.index - 1;\n if (slot < 0 || slot >= captures.length) {\n fail(\"numbers a capturing group outside its own capture list.\");\n }\n if (capture.name == null) continue;\n const units = utf16(capture.name);\n captures[slot] = {\n nameLength: units.length,\n nameOffset: nameUnits.length,\n named: true,\n };\n nameUnits.push(...units);\n }\n return { captures, nameUnits };\n}\n\nfunction flagMask(program: RegExpMatcherProgram): number {\n const flags = program.flags;\n return (\n (flags.hasIndices ? flagBits.hasIndices : 0) |\n (flags.global ? flagBits.global : 0) |\n (flags.ignoreCase ? flagBits.ignoreCase : 0) |\n (flags.multiline ? flagBits.multiline : 0) |\n (flags.dotAll ? flagBits.dotAll : 0) |\n (flags.unicode ? flagBits.unicode : 0) |\n (flags.unicodeSets ? flagBits.unicodeSets : 0) |\n (flags.sticky ? flagBits.sticky : 0)\n );\n}\n\n/**\n * Encode one matcher artifact in the generated-code ABI's layout.\n *\n * The artifact addresses its own instructions by position, and a\n * backreference to a duplicated group name expands to one encoded\n * instruction per candidate, so every branch target is remapped through\n * the encoded addresses rather than copied. The artifact builder charges\n * that expansion against its reviewed instruction limit, so the encoded\n * program is bounded by the same limit the artifact is.\n */\nexport function encodeRegExpProgram(\n program: RegExpMatcherProgram,\n): EncodedRegExpProgram {\n const addresses: number[] = [];\n let next = 0;\n for (const instruction of program.instructions) {\n addresses.push(next);\n next += encodedWidth(instruction);\n }\n const repeats = collectRepeats(program);\n const instructions: EncodedRegExpInstruction[] = [];\n for (const instruction of program.instructions) {\n instructions.push(\n ...encodeInstruction(instruction, addresses, repeats.indices),\n );\n }\n const setBoundaries: number[] = [];\n const setOffsets: number[] = [];\n for (const set of program.sets) {\n setOffsets.push(setBoundaries.length);\n setBoundaries.push(...set);\n }\n setOffsets.push(setBoundaries.length);\n const { captures, nameUnits } = encodeCaptures(program);\n const table = program.canonicalization;\n return {\n canonicalCharacters: table == null ? [] : [...table.characters],\n canonicalValues: table == null ? [] : [...table.canonical],\n captures,\n flagMask: flagMask(program),\n flagUnits: utf16(program.flags.text),\n hasGroupNames: captures.some((capture) => capture.named),\n ignoreCase: program.flags.ignoreCase,\n instructions,\n nameUnits,\n registers: program.registers,\n repeats: repeats.records.map((record) => ({\n clearFrom: record.clearFrom,\n clearTo: record.clearTo,\n maximum: record.maximum,\n minimum: record.minimum,\n })),\n setBoundaries,\n setOffsets,\n sourceUnits: utf16(program.source),\n unicodeMode: program.unicodeMode,\n };\n}\n"],"mappings":";;AAmFA,MAAM,UAAU;CACd,QAAQ;CACR,eAAe;CACf,UAAU;CACV,SAAS;CACT,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,QAAQ;CACR,WAAW;CAC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EACjC,aAAa,QAAQ;CACvB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oseo/backend-c",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-canary.370",
|
|
4
|
+
"description": "Deterministic C11 emission for Oseo backend input.",
|
|
5
|
+
"bugs": "https://github.com/dahlia/oseo/issues",
|
|
6
|
+
"license": "GPL-3.0-or-later AND MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Hong Minhee",
|
|
9
|
+
"email": "hong@minhee.org",
|
|
10
|
+
"url": "https://hongminhee.org/"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/dahlia/oseo.git",
|
|
15
|
+
"directory": "packages/backend-c"
|
|
16
|
+
},
|
|
17
|
+
"funding": "https://github.com/sponsors/dahlia",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"MIT-LICENSE.txt",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@oseo/compiler": "0.1.0-canary.370"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"deno": ">=2.9",
|
|
37
|
+
"node": ">=24"
|
|
38
|
+
}
|
|
6
39
|
}
|