@shapeshift-labs/frontier-lang-compiler 0.2.37 → 0.2.38
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/README.md +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +121 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -198,6 +198,7 @@ console.log(sidecar.summary.emptySemanticIndex); // false when symbols were foun
|
|
|
198
198
|
console.log(sidecar.ownershipRegions[0].key); // source#src/runtime.ts#type#Runtime
|
|
199
199
|
console.log(sidecar.patchHints[0].supportedOperations); // source-region patch operations
|
|
200
200
|
console.log(sidecar.proofSpec.obligations); // proof/spec obligations when the import carries a universal AST proof layer
|
|
201
|
+
console.log(sidecar.paradigmSemantics.hasLowering); // true when source import preserved lowering/paradigm records
|
|
201
202
|
```
|
|
202
203
|
|
|
203
204
|
The built-in JavaScript/TypeScript lightweight scanner also emits review-required ownership regions for clear route/config/content/property shapes in exported objects and arrays:
|
package/dist/index.d.ts
CHANGED
|
@@ -969,6 +969,7 @@ export interface SemanticImportSidecarImportEntry {
|
|
|
969
969
|
readonly universalAstLayerNames: readonly string[];
|
|
970
970
|
readonly universalAstLayerIds: readonly string[];
|
|
971
971
|
readonly proofSpec: SemanticImportSidecarProofSpecSummary;
|
|
972
|
+
readonly paradigmSemantics: SemanticImportSidecarParadigmSemanticsSummary;
|
|
972
973
|
readonly readiness: SemanticMergeReadiness;
|
|
973
974
|
readonly emptySemanticIndex: boolean;
|
|
974
975
|
readonly regionTaxonomy?: SemanticImportRegionTaxonomySummary;
|
|
@@ -1026,6 +1027,42 @@ export interface SemanticImportSidecarProofSpecSummary {
|
|
|
1026
1027
|
readonly empty: boolean;
|
|
1027
1028
|
}
|
|
1028
1029
|
|
|
1030
|
+
export interface SemanticImportSidecarParadigmSemanticsSummary {
|
|
1031
|
+
readonly total: number;
|
|
1032
|
+
readonly ids: readonly string[];
|
|
1033
|
+
readonly groups: readonly string[];
|
|
1034
|
+
readonly kinds: readonly string[];
|
|
1035
|
+
readonly evidence: number;
|
|
1036
|
+
readonly bindingScopes: number;
|
|
1037
|
+
readonly bindings: number;
|
|
1038
|
+
readonly patterns: number;
|
|
1039
|
+
readonly typeConstraints: number;
|
|
1040
|
+
readonly evaluationModels: number;
|
|
1041
|
+
readonly memoryLocations: number;
|
|
1042
|
+
readonly effectRegions: number;
|
|
1043
|
+
readonly controlRegions: number;
|
|
1044
|
+
readonly logicPrograms: number;
|
|
1045
|
+
readonly actorSystems: number;
|
|
1046
|
+
readonly stackEffects: number;
|
|
1047
|
+
readonly arrayShapes: number;
|
|
1048
|
+
readonly numericKernels: number;
|
|
1049
|
+
readonly dataflowNetworks: number;
|
|
1050
|
+
readonly clockModels: number;
|
|
1051
|
+
readonly objectModels: number;
|
|
1052
|
+
readonly macroExpansions: number;
|
|
1053
|
+
readonly reflectionBoundaries: number;
|
|
1054
|
+
readonly loweringRecords: number;
|
|
1055
|
+
readonly byGroup: Readonly<Record<string, number>>;
|
|
1056
|
+
readonly byKind: Readonly<Record<string, number>>;
|
|
1057
|
+
readonly hasRuntimeSemantics: boolean;
|
|
1058
|
+
readonly hasLogicSemantics: boolean;
|
|
1059
|
+
readonly hasStackSemantics: boolean;
|
|
1060
|
+
readonly hasArraySemantics: boolean;
|
|
1061
|
+
readonly hasMacroOrReflection: boolean;
|
|
1062
|
+
readonly hasLowering: boolean;
|
|
1063
|
+
readonly empty: boolean;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1029
1066
|
export interface SemanticImportSidecar {
|
|
1030
1067
|
readonly kind: 'frontier.lang.semanticImportSidecar';
|
|
1031
1068
|
readonly version: 1;
|
|
@@ -1056,6 +1093,7 @@ export interface SemanticImportSidecar {
|
|
|
1056
1093
|
};
|
|
1057
1094
|
readonly universalAstLayers: SemanticImportSidecarUniversalAstLayerSummary;
|
|
1058
1095
|
readonly proofSpec: SemanticImportSidecarProofSpecSummary;
|
|
1096
|
+
readonly paradigmSemantics: SemanticImportSidecarParadigmSemanticsSummary;
|
|
1059
1097
|
readonly patchHints: readonly SemanticImportPatchHint[];
|
|
1060
1098
|
readonly mergeCandidates: readonly {
|
|
1061
1099
|
readonly id?: string;
|
|
@@ -1090,6 +1128,9 @@ export interface SemanticImportSidecar {
|
|
|
1090
1128
|
readonly proofSpecRecords: number;
|
|
1091
1129
|
readonly proofSpecObligations: number;
|
|
1092
1130
|
readonly proofSpecFailedObligations: number;
|
|
1131
|
+
readonly paradigmSemanticsRecords: number;
|
|
1132
|
+
readonly paradigmSemanticsGroups: number;
|
|
1133
|
+
readonly paradigmSemanticsLoweringRecords: number;
|
|
1093
1134
|
readonly readiness: SemanticMergeReadiness;
|
|
1094
1135
|
readonly emptySemanticIndex: boolean;
|
|
1095
1136
|
};
|
package/dist/index.js
CHANGED
|
@@ -2567,6 +2567,7 @@ export function createSemanticImportSidecar(importResult, options = {}) {
|
|
|
2567
2567
|
const sourcePreservation = summarizeKernelSourcePreservation(importResult, imports);
|
|
2568
2568
|
const universalAstLayers = summarizeSemanticImportSidecarUniversalAstLayers(importEntries);
|
|
2569
2569
|
const proofSpec = summarizeSemanticImportSidecarProofSpec(importEntries);
|
|
2570
|
+
const paradigmSemantics = summarizeSemanticImportSidecarParadigmSemantics(importEntries);
|
|
2570
2571
|
const readiness = mergeCandidates.reduce(
|
|
2571
2572
|
(current, candidate) => maxSemanticMergeReadiness(current, candidate.readiness),
|
|
2572
2573
|
lossSummary.semanticMergeReadiness
|
|
@@ -2590,6 +2591,7 @@ export function createSemanticImportSidecar(importResult, options = {}) {
|
|
|
2590
2591
|
sourcePreservation,
|
|
2591
2592
|
universalAstLayers,
|
|
2592
2593
|
proofSpec,
|
|
2594
|
+
paradigmSemantics,
|
|
2593
2595
|
patchHints,
|
|
2594
2596
|
mergeCandidates: mergeCandidates.map((candidate) => ({
|
|
2595
2597
|
id: candidate.id,
|
|
@@ -2624,6 +2626,9 @@ export function createSemanticImportSidecar(importResult, options = {}) {
|
|
|
2624
2626
|
proofSpecRecords: proofSpec.total,
|
|
2625
2627
|
proofSpecObligations: proofSpec.obligations,
|
|
2626
2628
|
proofSpecFailedObligations: proofSpec.failed,
|
|
2629
|
+
paradigmSemanticsRecords: paradigmSemantics.total,
|
|
2630
|
+
paradigmSemanticsGroups: paradigmSemantics.groups.length,
|
|
2631
|
+
paradigmSemanticsLoweringRecords: paradigmSemantics.loweringRecords,
|
|
2627
2632
|
readiness,
|
|
2628
2633
|
emptySemanticIndex: symbols.length === 0
|
|
2629
2634
|
},
|
|
@@ -8588,6 +8593,7 @@ function semanticImportSidecarEntry(imported, index, options) {
|
|
|
8588
8593
|
const sourcePreservationRecords = collectKernelSourcePreservationFromImport(imported);
|
|
8589
8594
|
const universalAstLayers = summarizeUniversalAstLayers(imported?.universalAst);
|
|
8590
8595
|
const proofSpec = summarizeProofSpecLayer(imported?.universalAst?.proof ?? imported?.proof);
|
|
8596
|
+
const paradigmSemantics = summarizeParadigmSemanticsLayer(imported?.universalAst?.paradigmSemantics ?? imported?.paradigmSemantics);
|
|
8591
8597
|
const mappingsBySymbolId = new Map();
|
|
8592
8598
|
for (const mapping of sourceMapMappings) {
|
|
8593
8599
|
if (mapping.semanticSymbolId && !mappingsBySymbolId.has(mapping.semanticSymbolId)) {
|
|
@@ -8638,6 +8644,7 @@ function semanticImportSidecarEntry(imported, index, options) {
|
|
|
8638
8644
|
universalAstLayerNames: universalAstLayers.names,
|
|
8639
8645
|
universalAstLayerIds: universalAstLayers.ids,
|
|
8640
8646
|
proofSpec,
|
|
8647
|
+
paradigmSemantics,
|
|
8641
8648
|
readiness: imported?.metadata?.semanticMergeReadiness ?? imported?.mergeCandidates?.[0]?.readiness ?? 'needs-review',
|
|
8642
8649
|
emptySemanticIndex: symbols.length === 0,
|
|
8643
8650
|
regionTaxonomy,
|
|
@@ -8701,6 +8708,120 @@ function summarizeSemanticImportSidecarProofSpec(importEntries) {
|
|
|
8701
8708
|
};
|
|
8702
8709
|
}
|
|
8703
8710
|
|
|
8711
|
+
const ParadigmSemanticSummaryGroups = Object.freeze([
|
|
8712
|
+
'bindingScopes',
|
|
8713
|
+
'bindings',
|
|
8714
|
+
'patterns',
|
|
8715
|
+
'typeConstraints',
|
|
8716
|
+
'evaluationModels',
|
|
8717
|
+
'memoryLocations',
|
|
8718
|
+
'effectRegions',
|
|
8719
|
+
'controlRegions',
|
|
8720
|
+
'logicPrograms',
|
|
8721
|
+
'actorSystems',
|
|
8722
|
+
'stackEffects',
|
|
8723
|
+
'arrayShapes',
|
|
8724
|
+
'numericKernels',
|
|
8725
|
+
'dataflowNetworks',
|
|
8726
|
+
'clockModels',
|
|
8727
|
+
'objectModels',
|
|
8728
|
+
'macroExpansions',
|
|
8729
|
+
'reflectionBoundaries',
|
|
8730
|
+
'loweringRecords'
|
|
8731
|
+
]);
|
|
8732
|
+
|
|
8733
|
+
function summarizeSemanticImportSidecarParadigmSemantics(importEntries) {
|
|
8734
|
+
const totals = emptyParadigmSemanticsSummary();
|
|
8735
|
+
const ids = [];
|
|
8736
|
+
const kinds = [];
|
|
8737
|
+
const byGroup = {};
|
|
8738
|
+
const byKind = {};
|
|
8739
|
+
for (const entry of importEntries) {
|
|
8740
|
+
const summary = entry.paradigmSemantics ?? summarizeParadigmSemanticsLayer();
|
|
8741
|
+
ids.push(...(summary.ids ?? []));
|
|
8742
|
+
kinds.push(...(summary.kinds ?? []));
|
|
8743
|
+
totals.total += summary.total ?? 0;
|
|
8744
|
+
totals.evidence += summary.evidence ?? 0;
|
|
8745
|
+
for (const group of ParadigmSemanticSummaryGroups) {
|
|
8746
|
+
totals[group] += summary[group] ?? 0;
|
|
8747
|
+
}
|
|
8748
|
+
for (const [group, count] of Object.entries(summary.byGroup ?? {})) {
|
|
8749
|
+
byGroup[group] = (byGroup[group] ?? 0) + count;
|
|
8750
|
+
}
|
|
8751
|
+
for (const [kind, count] of Object.entries(summary.byKind ?? {})) {
|
|
8752
|
+
byKind[kind] = (byKind[kind] ?? 0) + count;
|
|
8753
|
+
}
|
|
8754
|
+
}
|
|
8755
|
+
return {
|
|
8756
|
+
...totals,
|
|
8757
|
+
ids: uniqueStrings(ids),
|
|
8758
|
+
groups: uniqueStrings(Object.keys(byGroup).filter((group) => byGroup[group] > 0)),
|
|
8759
|
+
kinds: uniqueStrings(kinds),
|
|
8760
|
+
byGroup,
|
|
8761
|
+
byKind,
|
|
8762
|
+
hasRuntimeSemantics: hasAnyParadigmCount(totals, ['evaluationModels', 'memoryLocations', 'effectRegions', 'controlRegions', 'actorSystems', 'clockModels']),
|
|
8763
|
+
hasLogicSemantics: totals.logicPrograms > 0,
|
|
8764
|
+
hasStackSemantics: totals.stackEffects > 0,
|
|
8765
|
+
hasArraySemantics: totals.arrayShapes > 0 || totals.numericKernels > 0,
|
|
8766
|
+
hasMacroOrReflection: totals.macroExpansions > 0 || totals.reflectionBoundaries > 0,
|
|
8767
|
+
hasLowering: totals.loweringRecords > 0,
|
|
8768
|
+
empty: totals.total === 0
|
|
8769
|
+
};
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
function summarizeParadigmSemanticsLayer(paradigmSemantics = {}) {
|
|
8773
|
+
const totals = emptyParadigmSemanticsSummary();
|
|
8774
|
+
const ids = [];
|
|
8775
|
+
const kinds = [];
|
|
8776
|
+
const byGroup = {};
|
|
8777
|
+
const byKind = {};
|
|
8778
|
+
ids.push(paradigmSemantics?.id);
|
|
8779
|
+
for (const group of ParadigmSemanticSummaryGroups) {
|
|
8780
|
+
const records = paradigmSemantics?.[group] ?? [];
|
|
8781
|
+
totals[group] = records.length;
|
|
8782
|
+
totals.total += records.length;
|
|
8783
|
+
if (records.length > 0) {
|
|
8784
|
+
byGroup[group] = records.length;
|
|
8785
|
+
}
|
|
8786
|
+
for (const record of records) {
|
|
8787
|
+
ids.push(record?.id);
|
|
8788
|
+
if (record?.kind) {
|
|
8789
|
+
kinds.push(record.kind);
|
|
8790
|
+
byKind[record.kind] = (byKind[record.kind] ?? 0) + 1;
|
|
8791
|
+
}
|
|
8792
|
+
}
|
|
8793
|
+
}
|
|
8794
|
+
totals.evidence = (paradigmSemantics?.evidence ?? []).length;
|
|
8795
|
+
ids.push(...(paradigmSemantics?.evidence ?? []).map((record) => record?.id));
|
|
8796
|
+
return {
|
|
8797
|
+
...totals,
|
|
8798
|
+
ids: uniqueStrings(ids.filter(Boolean)),
|
|
8799
|
+
groups: uniqueStrings(Object.keys(byGroup)),
|
|
8800
|
+
kinds: uniqueStrings(kinds),
|
|
8801
|
+
byGroup,
|
|
8802
|
+
byKind,
|
|
8803
|
+
hasRuntimeSemantics: hasAnyParadigmCount(totals, ['evaluationModels', 'memoryLocations', 'effectRegions', 'controlRegions', 'actorSystems', 'clockModels']),
|
|
8804
|
+
hasLogicSemantics: totals.logicPrograms > 0,
|
|
8805
|
+
hasStackSemantics: totals.stackEffects > 0,
|
|
8806
|
+
hasArraySemantics: totals.arrayShapes > 0 || totals.numericKernels > 0,
|
|
8807
|
+
hasMacroOrReflection: totals.macroExpansions > 0 || totals.reflectionBoundaries > 0,
|
|
8808
|
+
hasLowering: totals.loweringRecords > 0,
|
|
8809
|
+
empty: totals.total === 0
|
|
8810
|
+
};
|
|
8811
|
+
}
|
|
8812
|
+
|
|
8813
|
+
function emptyParadigmSemanticsSummary() {
|
|
8814
|
+
return {
|
|
8815
|
+
total: 0,
|
|
8816
|
+
evidence: 0,
|
|
8817
|
+
...Object.fromEntries(ParadigmSemanticSummaryGroups.map((group) => [group, 0]))
|
|
8818
|
+
};
|
|
8819
|
+
}
|
|
8820
|
+
|
|
8821
|
+
function hasAnyParadigmCount(summary, groups) {
|
|
8822
|
+
return groups.some((group) => (summary[group] ?? 0) > 0);
|
|
8823
|
+
}
|
|
8824
|
+
|
|
8704
8825
|
function summarizeProofSpecLayer(proof = {}) {
|
|
8705
8826
|
const contracts = proof?.contracts ?? [];
|
|
8706
8827
|
const refinements = proof?.refinements ?? [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshift-labs/frontier-lang-compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@shapeshift-labs/frontier-lang-c": "0.2.5",
|
|
60
60
|
"@shapeshift-labs/frontier-lang-checker": "0.3.4",
|
|
61
61
|
"@shapeshift-labs/frontier-lang-javascript": "0.2.5",
|
|
62
|
-
"@shapeshift-labs/frontier-lang-kernel": "0.3.
|
|
62
|
+
"@shapeshift-labs/frontier-lang-kernel": "0.3.8",
|
|
63
63
|
"@shapeshift-labs/frontier-lang-parser": "0.3.4",
|
|
64
64
|
"@shapeshift-labs/frontier-lang-python": "0.2.5",
|
|
65
65
|
"@shapeshift-labs/frontier-lang-rust": "0.2.5",
|