@scriptc/compiler 0.0.7 → 0.0.8
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/dist/backend/emission/emit-exprs.js +47 -1
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-island.js +9 -1
- package/dist/backend/emission/emit-island.js.map +1 -1
- package/dist/backend/emission/emit-stmts.js +3 -1
- package/dist/backend/emission/emit-stmts.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +22 -8
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.js +5 -1
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/emission/may-throw.js +4 -3
- package/dist/backend/emission/may-throw.js.map +1 -1
- package/dist/backend/llvm/emitter.js +94 -7
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +43 -1
- package/dist/diagnostics/diagnostic.js +103 -5
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +24 -6
- package/dist/frontend/lib-contract.js +125 -44
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.js +16 -1
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +47 -7
- package/dist/frontend/lowering/lower-calls.js +560 -36
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +14 -1
- package/dist/frontend/lowering/lower-classes.js +85 -15
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +43 -1
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-emitter.js +1 -1
- package/dist/frontend/lowering/lower-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +26 -3
- package/dist/frontend/lowering/lower-exprs.js +455 -40
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +7 -0
- package/dist/frontend/lowering/lower-island.js +71 -10
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.d.ts +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-modules.js +95 -4
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +421 -43
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +19 -3
- package/dist/frontend/lowering/lowerer.js +188 -11
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/types.d.ts +28 -1
- package/dist/frontend/types.js +300 -8
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -7
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +28 -2
- package/dist/ir/nodes.js +35 -3
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +35 -6
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/profile.d.ts +17 -3
- package/dist/library/profile.js +38 -9
- package/dist/library/profile.js.map +1 -1
- package/dist/library/sidecar.js +162 -43
- package/dist/library/sidecar.js.map +1 -1
- package/dist/library/trap-teaching.d.ts +11 -0
- package/dist/library/trap-teaching.js +49 -0
- package/dist/library/trap-teaching.js.map +1 -0
- package/package.json +2 -2
- package/surface-manifest.json +37 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* The structured trap-teaching encoding (ratified 2026-07-23). A library-mode
|
|
2
|
+
* sink message that carries a diagnostic code and/or the trapping symbol is
|
|
3
|
+
* assembled as
|
|
4
|
+
*
|
|
5
|
+
* 0x01 text 0x1F code 0x1F symbol [ 0x1F remediation ]
|
|
6
|
+
*
|
|
7
|
+
* The human teaching text LEADS the buffer so a plain-text host still shows
|
|
8
|
+
* something useful; 0x01 (ASCII SOH) is the version marker — every baseline
|
|
9
|
+
* (unstructured) message is UTF-8 whose first byte is printable, and no
|
|
10
|
+
* emitter path may ever produce an unstructured message whose first byte is
|
|
11
|
+
* below 0x20, so `msg_len > 0 && msg[0] == 0x01` identifies a structured
|
|
12
|
+
* message unambiguously. Fields ride 0x1F (ASCII Unit Separator); the whole
|
|
13
|
+
* remediation field, separator included, is absent when the profile supplies
|
|
14
|
+
* none. Emitters MUST NOT append fields beyond these four under this marker;
|
|
15
|
+
* parsers MUST ignore any field past the fourth.
|
|
16
|
+
*
|
|
17
|
+
* Division of labor (the spec's compatibility clause): the profile authors
|
|
18
|
+
* teaching and remediation text, the COMPILER assembles the buffer here
|
|
19
|
+
* (code, symbol, framing), and the runtime funnel and the host sink carry
|
|
20
|
+
* the bytes opaque and unchanged — the sink signature (ctx, msg pointer,
|
|
21
|
+
* len, address) is frozen; all structure lives in the message bytes.
|
|
22
|
+
*
|
|
23
|
+
* Code space: SC-prefixed codes belong exclusively to the compiler's
|
|
24
|
+
* diagnostics registry; embedder-supplied codes are embedder-prefixed and
|
|
25
|
+
* validated only as tokens free of the reserved bytes (profile.ts), never
|
|
26
|
+
* for registry membership. */
|
|
27
|
+
/** The structured-message version marker (byte 0). A future encoding
|
|
28
|
+
* revision bumps the marker byte — the marker IS the version. */
|
|
29
|
+
export const TRAP_TEACHING_MARKER = "\u0001";
|
|
30
|
+
/** The field separator between text, code, symbol, and remediation. */
|
|
31
|
+
export const TRAP_TEACHING_SEP = "\u001f";
|
|
32
|
+
/** Assemble one structured trap-teaching message. Every field must already
|
|
33
|
+
* be free of the two reserved bytes — profile-supplied text is validated at
|
|
34
|
+
* profile load (SC4001), and the compiler's own texts, codes, and symbols
|
|
35
|
+
* never contain control bytes — so a violation here is an internal error,
|
|
36
|
+
* never a user-reportable state. */
|
|
37
|
+
export function assembleTrapTeaching(text, code, symbol, remediation) {
|
|
38
|
+
const fields = [["text", text], ["code", code], ["symbol", symbol]];
|
|
39
|
+
if (remediation !== undefined)
|
|
40
|
+
fields.push(["remediation", remediation]);
|
|
41
|
+
for (const [name, value] of fields) {
|
|
42
|
+
if (value.includes(TRAP_TEACHING_MARKER) || value.includes(TRAP_TEACHING_SEP)) {
|
|
43
|
+
throw new Error(`trap-teaching assembler: ${name} contains a reserved byte (0x01/0x1F)`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return (TRAP_TEACHING_MARKER + text + TRAP_TEACHING_SEP + code + TRAP_TEACHING_SEP + symbol +
|
|
47
|
+
(remediation !== undefined ? TRAP_TEACHING_SEP + remediation : ""));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=trap-teaching.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trap-teaching.js","sourceRoot":"","sources":["../../src/library/trap-teaching.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;8BAyB8B;AAE9B;iEACiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAC7C,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C;;;;oCAIoC;AACpC,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,WAAoB;IAEpB,MAAM,MAAM,GAAuB,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACxF,IAAI,WAAW,KAAK,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;IACzE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACnC,IAAI,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,uCAAuC,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;IACD,OAAO,CACL,oBAAoB,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,GAAG,iBAAiB,GAAG,MAAM;QACnF,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAiB,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CACnE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scriptc/compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The scriptc compiler — TypeScript/JavaScript frontend, typed IR, LLVM and C backends",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://scriptc.dev",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"typescript": "7.0.2",
|
|
32
32
|
"typescript5": "npm:typescript@5.9.3",
|
|
33
|
-
"@scriptc/runtime": "0.0.
|
|
33
|
+
"@scriptc/runtime": "0.0.8"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "node node_modules/typescript5/bin/tsc -p tsconfig.json"
|
package/surface-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"compilerVersion": "0.0.
|
|
3
|
+
"compilerVersion": "0.0.8",
|
|
4
4
|
"coverage": [
|
|
5
5
|
"Entries are projected mechanically from the compiler's own decision tables: the diagnostics registry, the unsupported-syntax dispatch tables, the stdlib and node-builtin lowering tables, and the supported-builtin-module list. Nothing is hand-maintained; the manifest regenerates byte-identically from the source tree at this version.",
|
|
6
6
|
"Absence from this manifest means 'not projected', never 'unsupported'. Surfaces lowered through dedicated code paths rather than tables are not yet projected: console, JSON, process, Promise/async and the timer surface, the net/http/tls/https/dgram/dns/assert/test/stream/readline module member surfaces, template literals, the regex slice, and global functions (parseInt, parseFloat, isNaN, isFinite).",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
{
|
|
202
202
|
"id": "diagnostic.sc2001",
|
|
203
203
|
"kind": "diagnostic-fence",
|
|
204
|
-
"name": "values of types outside the compilable set",
|
|
204
|
+
"name": "values of types outside the compilable set (bigint and symbol primitives, constructor objects, and library-derived or unresolved generic shapes)",
|
|
205
205
|
"status": "unsupported",
|
|
206
206
|
"code": "SC2001"
|
|
207
207
|
},
|
|
@@ -226,6 +226,41 @@
|
|
|
226
226
|
"status": "unsupported",
|
|
227
227
|
"code": "SC2004"
|
|
228
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"id": "diagnostic.sc2005",
|
|
231
|
+
"kind": "diagnostic-fence",
|
|
232
|
+
"name": "values whose type keeps a generic call signature (a compiled function is one concrete signature)",
|
|
233
|
+
"status": "unsupported",
|
|
234
|
+
"code": "SC2005"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"id": "diagnostic.sc2006",
|
|
238
|
+
"kind": "diagnostic-fence",
|
|
239
|
+
"name": "index-signature object types outside the supported shape",
|
|
240
|
+
"status": "unsupported",
|
|
241
|
+
"code": "SC2006"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"id": "diagnostic.sc2007",
|
|
245
|
+
"kind": "diagnostic-fence",
|
|
246
|
+
"name": "values of overloaded function type (a compiled function value is one signature)",
|
|
247
|
+
"status": "unsupported",
|
|
248
|
+
"code": "SC2007"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"id": "diagnostic.sc2008",
|
|
252
|
+
"kind": "diagnostic-fence",
|
|
253
|
+
"name": "intersection types with no resolved lowering",
|
|
254
|
+
"status": "unsupported",
|
|
255
|
+
"code": "SC2008"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"id": "diagnostic.sc2009",
|
|
259
|
+
"kind": "diagnostic-fence",
|
|
260
|
+
"name": "supported container and function shapes over a component type outside its slot",
|
|
261
|
+
"status": "unsupported",
|
|
262
|
+
"code": "SC2009"
|
|
263
|
+
},
|
|
229
264
|
{
|
|
230
265
|
"id": "diagnostic.sc2010",
|
|
231
266
|
"kind": "diagnostic-fence",
|