self-host TCS compiler GIR and add portable host runtime
This commit is contained in:
parent
3959ae4270
commit
ff29e52a32
33 changed files with 3848 additions and 831 deletions
74
scripts/build-tcs-migration-registry.mjs
Normal file
74
scripts/build-tcs-migration-registry.mjs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/env node
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const root = path.resolve(import.meta.dirname, "..");
|
||||
const registry = JSON.parse(fs.readFileSync(path.join(root, "parts/registry.json"), "utf8"));
|
||||
|
||||
const phase0 = new Set([
|
||||
"HLP-PART-TCS-LANG-0001",
|
||||
"HLP-PART-TCS-SELFHOST-0001",
|
||||
"HLP-PART-TCS-STAGE0-0001",
|
||||
"HLP-PART-GIR-0001",
|
||||
"HLP-PART-REG-0001",
|
||||
"HLP-PART-NQG-0001",
|
||||
"HLP-PART-QA-0001",
|
||||
]);
|
||||
const phase2Prefixes = ["HLP-PART-AFF", "HLP-PART-MEM", "HLP-PART-REL", "HLP-PART-CX"];
|
||||
|
||||
function phase(part) {
|
||||
if (phase0.has(part.id)) return "P0_LANGUAGE_RUNTIME_AND_QUALITY";
|
||||
if (part.id === "HLP-PART-0090") return "P3_SHARED_WORLD_PROJECTOR_LAST";
|
||||
if (phase2Prefixes.some((prefix) => part.id.startsWith(prefix))) {
|
||||
return "P2_PERSONA_MEMORY_RELATION_AND_AFFECT";
|
||||
}
|
||||
return "P1_NUMBER_CHANNEL_AGENT_KNOWLEDGE_AND_MARKET";
|
||||
}
|
||||
|
||||
const entries = registry.parts.map((part, index) => {
|
||||
const alreadyTcs = [
|
||||
"HLP-PART-TCS-LANG-0001",
|
||||
"HLP-PART-TCS-SELFHOST-0001",
|
||||
"HLP-PART-TCS-STAGE0-0001",
|
||||
].includes(part.id);
|
||||
return {
|
||||
order: index + 1,
|
||||
part_id: part.id,
|
||||
display_name_zh: part.displayName,
|
||||
donor_source: part.source,
|
||||
donor_state: part.status,
|
||||
native_acceptance_before_migration: part.nativeAcceptance,
|
||||
migration_phase: phase(part),
|
||||
target_module_id: `TCS-MOD-${part.id.replace(/^HLP-PART-/, "")}`,
|
||||
rewrite_rule: alreadyTcs
|
||||
? "CONTINUE_NATIVE_TCS_IMPLEMENTATION"
|
||||
: "REWRITE_SEMANTICS_STATE_MACHINE_AUTHORITY_FAILURE_AND_RECEIPTS_IN_TCS",
|
||||
host_adapter_rule: "KEEP_ONLY_MINIMUM_OS_ABI_DRIVER_OUTSIDE_TCS_MODULE",
|
||||
migration_state: alreadyTcs ? "ACTIVE" : "QUEUED",
|
||||
acceptance_required: [
|
||||
"TCS_SOURCE_COMPILES_WITH_COMPILER_B",
|
||||
"GIR_HAS_NO_UNRESOLVED_NATURAL_LANGUAGE",
|
||||
"NEGATIVE_AUTHORITY_AND_PATH_TESTS_FAIL_CLOSED",
|
||||
"TARGET_RUNTIME_READBACK",
|
||||
"DONOR_PARITY_OR_EXPLICIT_REJECTION_RECEIPT",
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
const output = {
|
||||
schema: "hololake.tcs-module-migration-registry/v1",
|
||||
registry_id: "HLP-TCS-MIGRATION-REGISTRY-0001",
|
||||
source_parts_registry: "parts/registry.json",
|
||||
source_part_count: registry.parts.length,
|
||||
rule: "NO_WHOLESALE_TRANSLITERATION_FROM_RUST_OR_TYPESCRIPT",
|
||||
compiler: "TCS-COMPILER-STAGE1-0001",
|
||||
target_abi: "GIR/1",
|
||||
registration_is_rewrite: false,
|
||||
rewrite_is_acceptance: false,
|
||||
entries,
|
||||
};
|
||||
|
||||
const target = path.join(root, "migration/tcs-module-migration-registry.json");
|
||||
fs.mkdirSync(path.dirname(target), { recursive: true });
|
||||
fs.writeFileSync(target, `${JSON.stringify(output, null, 2)}\n`);
|
||||
console.log(`WROTE ${target} entries=${entries.length}`);
|
||||
Loading…
Reference in a new issue