@jhlagado/azm 0.2.6 → 0.2.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.
Files changed (235) hide show
  1. package/README.md +170 -69
  2. package/dist/src/api-artifacts.d.ts +20 -0
  3. package/dist/src/api-artifacts.js +165 -0
  4. package/dist/src/api-compile.d.ts +8 -2
  5. package/dist/src/api-compile.js +31 -230
  6. package/dist/src/api-register-contracts.d.ts +9 -0
  7. package/dist/src/api-register-contracts.js +77 -0
  8. package/dist/src/api-tooling.d.ts +2 -2
  9. package/dist/src/api-tooling.js +1 -1
  10. package/dist/src/assembly/address-planning.d.ts +1 -2
  11. package/dist/src/assembly/address-planning.js +119 -218
  12. package/dist/src/assembly/address-symbols.d.ts +12 -0
  13. package/dist/src/assembly/address-symbols.js +118 -0
  14. package/dist/src/assembly/fixup-emission.js +30 -48
  15. package/dist/src/assembly/program-emission.js +163 -164
  16. package/dist/src/cli/artifact-files.d.ts +15 -0
  17. package/dist/src/cli/artifact-files.js +86 -0
  18. package/dist/src/cli/parse-args.d.ts +6 -5
  19. package/dist/src/cli/parse-args.js +162 -136
  20. package/dist/src/cli/run.js +4 -1
  21. package/dist/src/cli/usage.d.ts +1 -0
  22. package/dist/src/cli/usage.js +33 -0
  23. package/dist/src/cli/write-artifacts.js +18 -91
  24. package/dist/src/core/compile.js +51 -274
  25. package/dist/src/core/conditional-assembly.d.ts +6 -0
  26. package/dist/src/core/conditional-assembly.js +181 -0
  27. package/dist/src/expansion/op-constant-expression.d.ts +3 -0
  28. package/dist/src/expansion/op-constant-expression.js +52 -0
  29. package/dist/src/expansion/op-expand-selected.d.ts +5 -0
  30. package/dist/src/expansion/op-expand-selected.js +143 -0
  31. package/dist/src/expansion/op-expansion.d.ts +5 -53
  32. package/dist/src/expansion/op-expansion.js +85 -815
  33. package/dist/src/expansion/op-instruction-instantiation.d.ts +3 -0
  34. package/dist/src/expansion/op-instruction-instantiation.js +194 -0
  35. package/dist/src/expansion/op-local-labels.d.ts +8 -0
  36. package/dist/src/expansion/op-local-labels.js +166 -0
  37. package/dist/src/expansion/op-operand-splitting.d.ts +1 -0
  38. package/dist/src/expansion/op-operand-splitting.js +44 -0
  39. package/dist/src/expansion/op-operands.d.ts +53 -0
  40. package/dist/src/expansion/op-operands.js +66 -0
  41. package/dist/src/expansion/op-selection.d.ts +18 -0
  42. package/dist/src/expansion/op-selection.js +172 -0
  43. package/dist/src/index.d.ts +2 -1
  44. package/dist/src/index.js +1 -1
  45. package/dist/src/model/diagnostic.d.ts +4 -0
  46. package/dist/src/model/diagnostic.js +4 -0
  47. package/dist/src/outputs/asm80-expression-evaluation.d.ts +10 -0
  48. package/dist/src/outputs/asm80-expression-evaluation.js +75 -0
  49. package/dist/src/outputs/asm80-expressions.d.ts +5 -0
  50. package/dist/src/outputs/asm80-expressions.js +47 -0
  51. package/dist/src/outputs/asm80-instruction-operands.d.ts +16 -0
  52. package/dist/src/outputs/asm80-instruction-operands.js +38 -0
  53. package/dist/src/outputs/asm80-instructions.d.ts +5 -0
  54. package/dist/src/outputs/asm80-instructions.js +272 -0
  55. package/dist/src/outputs/asm80-ld-operands.d.ts +10 -0
  56. package/dist/src/outputs/asm80-ld-operands.js +157 -0
  57. package/dist/src/outputs/asm80-strings.d.ts +4 -0
  58. package/dist/src/outputs/asm80-strings.js +14 -0
  59. package/dist/src/outputs/d8-files.d.ts +10 -0
  60. package/dist/src/outputs/d8-files.js +103 -0
  61. package/dist/src/outputs/d8-helpers.d.ts +21 -0
  62. package/dist/src/outputs/d8-helpers.js +136 -0
  63. package/dist/src/outputs/hex.js +26 -18
  64. package/dist/src/outputs/types.d.ts +16 -10
  65. package/dist/src/outputs/write-asm80.js +68 -597
  66. package/dist/src/outputs/write-d8.js +6 -216
  67. package/dist/src/register-contracts/accept-output.d.ts +2 -0
  68. package/dist/src/register-contracts/analyze-helpers.d.ts +29 -0
  69. package/dist/src/register-contracts/analyze-helpers.js +162 -0
  70. package/dist/src/{register-care → register-contracts}/analyze.d.ts +6 -6
  71. package/dist/src/register-contracts/analyze.js +73 -0
  72. package/dist/src/register-contracts/annotate.d.ts +11 -0
  73. package/dist/src/{register-care → register-contracts}/annotate.js +3 -3
  74. package/dist/src/register-contracts/annotations.d.ts +8 -0
  75. package/dist/src/{register-care → register-contracts}/annotations.js +3 -3
  76. package/dist/src/register-contracts/boundaryHints.d.ts +3 -0
  77. package/dist/src/register-contracts/boundaryHints.js +24 -0
  78. package/dist/src/register-contracts/carriers.d.ts +2 -0
  79. package/dist/src/register-contracts/constants.d.ts +4 -0
  80. package/dist/src/register-contracts/constants.js +51 -0
  81. package/dist/src/register-contracts/controlFlow.d.ts +5 -0
  82. package/dist/src/register-contracts/controlFlow.js +55 -0
  83. package/dist/src/register-contracts/fix.d.ts +11 -0
  84. package/dist/src/{register-care → register-contracts}/fix.js +47 -30
  85. package/dist/src/register-contracts/instruction-head.d.ts +2 -0
  86. package/dist/src/register-contracts/instruction-head.js +3 -0
  87. package/dist/src/register-contracts/instruction-operands.d.ts +3 -0
  88. package/dist/src/register-contracts/instruction-operands.js +101 -0
  89. package/dist/src/register-contracts/instruction-predicates.d.ts +6 -0
  90. package/dist/src/register-contracts/instruction-predicates.js +44 -0
  91. package/dist/src/register-contracts/interfaceContracts.d.ts +2 -0
  92. package/dist/src/register-contracts/interfaceContracts.js +68 -0
  93. package/dist/src/register-contracts/liveness.d.ts +3 -0
  94. package/dist/src/{register-care → register-contracts}/liveness.js +111 -79
  95. package/dist/src/register-contracts/operand-register-name.d.ts +2 -0
  96. package/dist/src/register-contracts/operand-register-name.js +13 -0
  97. package/dist/src/{register-care → register-contracts}/profiles.d.ts +5 -5
  98. package/dist/src/{register-care → register-contracts}/profiles.js +13 -2
  99. package/dist/src/register-contracts/programModel-boundaries.d.ts +6 -0
  100. package/dist/src/register-contracts/programModel-boundaries.js +64 -0
  101. package/dist/src/register-contracts/programModel-routines.d.ts +7 -0
  102. package/dist/src/register-contracts/programModel-routines.js +128 -0
  103. package/dist/src/register-contracts/programModel.d.ts +3 -0
  104. package/dist/src/register-contracts/programModel.js +14 -0
  105. package/dist/src/register-contracts/report.d.ts +5 -0
  106. package/dist/src/{register-care → register-contracts}/report.js +34 -17
  107. package/dist/src/register-contracts/routine-summaries.d.ts +6 -0
  108. package/dist/src/{register-care → register-contracts}/routine-summaries.js +11 -1
  109. package/dist/src/register-contracts/smartCommentBlocks.d.ts +5 -0
  110. package/dist/src/register-contracts/smartCommentBlocks.js +30 -0
  111. package/dist/src/register-contracts/smartCommentParsing.d.ts +3 -0
  112. package/dist/src/register-contracts/smartCommentParsing.js +80 -0
  113. package/dist/src/register-contracts/smartComments.d.ts +5 -0
  114. package/dist/src/register-contracts/smartComments.js +92 -0
  115. package/dist/src/register-contracts/summaries.d.ts +12 -0
  116. package/dist/src/{register-care → register-contracts}/summaries.js +7 -7
  117. package/dist/src/register-contracts/summary-boundary.d.ts +2 -0
  118. package/dist/src/register-contracts/summary-boundary.js +40 -0
  119. package/dist/src/register-contracts/summary-contract.d.ts +2 -0
  120. package/dist/src/register-contracts/summary-contract.js +45 -0
  121. package/dist/src/register-contracts/summary-result.d.ts +7 -0
  122. package/dist/src/register-contracts/summary-result.js +122 -0
  123. package/dist/src/register-contracts/summary-state.d.ts +23 -0
  124. package/dist/src/register-contracts/summary-state.js +88 -0
  125. package/dist/src/register-contracts/summary-token-transfer.d.ts +3 -0
  126. package/dist/src/register-contracts/summary-token-transfer.js +67 -0
  127. package/dist/src/register-contracts/summary.d.ts +3 -0
  128. package/dist/src/register-contracts/summary.js +266 -0
  129. package/dist/src/register-contracts/tooling.d.ts +57 -0
  130. package/dist/src/{register-care → register-contracts}/tooling.js +8 -6
  131. package/dist/src/register-contracts/types.d.ts +188 -0
  132. package/dist/src/semantics/binary-operators.d.ts +2 -0
  133. package/dist/src/semantics/binary-operators.js +15 -0
  134. package/dist/src/semantics/byte-functions.d.ts +2 -0
  135. package/dist/src/semantics/byte-functions.js +7 -0
  136. package/dist/src/semantics/constant-operator-types.d.ts +10 -0
  137. package/dist/src/semantics/constant-operator-types.js +1 -0
  138. package/dist/src/semantics/constant-operators.d.ts +3 -0
  139. package/dist/src/semantics/constant-operators.js +3 -0
  140. package/dist/src/semantics/diagnostics.d.ts +3 -0
  141. package/dist/src/semantics/diagnostics.js +10 -0
  142. package/dist/src/semantics/expression-evaluation.d.ts +11 -19
  143. package/dist/src/semantics/expression-evaluation.js +22 -334
  144. package/dist/src/semantics/layout-evaluation.d.ts +23 -0
  145. package/dist/src/semantics/layout-evaluation.js +202 -0
  146. package/dist/src/semantics/layout-format.d.ts +5 -0
  147. package/dist/src/semantics/layout-format.js +31 -0
  148. package/dist/src/semantics/layout-path.d.ts +24 -0
  149. package/dist/src/semantics/layout-path.js +58 -0
  150. package/dist/src/semantics/unary-operators.d.ts +2 -0
  151. package/dist/src/semantics/unary-operators.js +8 -0
  152. package/dist/src/source/line-comment-scanner.d.ts +1 -0
  153. package/dist/src/source/line-comment-scanner.js +51 -0
  154. package/dist/src/source/strip-line-comment.js +8 -44
  155. package/dist/src/syntax/directive-aliases.js +36 -22
  156. package/dist/src/syntax/expression-tokenizer.d.ts +30 -0
  157. package/dist/src/syntax/expression-tokenizer.js +310 -0
  158. package/dist/src/syntax/parse-directive-statement.d.ts +14 -0
  159. package/dist/src/syntax/parse-directive-statement.js +307 -0
  160. package/dist/src/syntax/parse-expression.d.ts +2 -2
  161. package/dist/src/syntax/parse-expression.js +7 -568
  162. package/dist/src/syntax/parse-layout-declarations.d.ts +9 -0
  163. package/dist/src/syntax/parse-layout-declarations.js +180 -0
  164. package/dist/src/syntax/parse-layout-expression.d.ts +5 -0
  165. package/dist/src/syntax/parse-layout-expression.js +175 -0
  166. package/dist/src/syntax/parse-line.js +4 -272
  167. package/dist/src/syntax/parse-token-expression.d.ts +3 -0
  168. package/dist/src/syntax/parse-token-expression.js +133 -0
  169. package/dist/src/tooling/case-style.js +47 -30
  170. package/dist/src/z80/effect-groups.d.ts +38 -0
  171. package/dist/src/z80/effect-groups.js +265 -0
  172. package/dist/src/z80/effect-units.d.ts +18 -0
  173. package/dist/src/z80/effect-units.js +165 -0
  174. package/dist/src/z80/effects.d.ts +1 -1
  175. package/dist/src/z80/effects.js +94 -557
  176. package/dist/src/z80/encode-core.d.ts +2 -0
  177. package/dist/src/z80/encode-core.js +42 -0
  178. package/dist/src/z80/encode-ld-helpers.d.ts +25 -0
  179. package/dist/src/z80/encode-ld-helpers.js +172 -0
  180. package/dist/src/z80/encode-ld.d.ts +2 -0
  181. package/dist/src/z80/encode-ld.js +285 -0
  182. package/dist/src/z80/encode.js +190 -542
  183. package/dist/src/z80/ld-support.d.ts +3 -0
  184. package/dist/src/z80/ld-support.js +146 -0
  185. package/dist/src/z80/operand-split-state.d.ts +8 -0
  186. package/dist/src/z80/operand-split-state.js +46 -0
  187. package/dist/src/z80/operand-split.d.ts +1 -0
  188. package/dist/src/z80/operand-split.js +13 -0
  189. package/dist/src/z80/parse-basic.d.ts +4 -0
  190. package/dist/src/z80/parse-basic.js +39 -0
  191. package/dist/src/z80/parse-branch.d.ts +4 -0
  192. package/dist/src/z80/parse-branch.js +218 -0
  193. package/dist/src/z80/parse-conditions.d.ts +6 -0
  194. package/dist/src/z80/parse-conditions.js +10 -0
  195. package/dist/src/z80/parse-exchange.d.ts +2 -0
  196. package/dist/src/z80/parse-exchange.js +30 -0
  197. package/dist/src/z80/parse-instruction.js +224 -1010
  198. package/dist/src/z80/parse-io-control.d.ts +5 -0
  199. package/dist/src/z80/parse-io-control.js +108 -0
  200. package/dist/src/z80/parse-ld.d.ts +2 -0
  201. package/dist/src/z80/parse-ld.js +83 -0
  202. package/dist/src/z80/parse-operands.d.ts +41 -0
  203. package/dist/src/z80/parse-operands.js +259 -0
  204. package/docs/reference/cli.md +42 -35
  205. package/docs/reference/tooling-api.md +20 -16
  206. package/package.json +1 -1
  207. package/dist/src/register-care/accept-output.d.ts +0 -2
  208. package/dist/src/register-care/analyze.js +0 -166
  209. package/dist/src/register-care/annotate.d.ts +0 -11
  210. package/dist/src/register-care/annotations.d.ts +0 -8
  211. package/dist/src/register-care/boundaryHints.d.ts +0 -3
  212. package/dist/src/register-care/boundaryHints.js +0 -80
  213. package/dist/src/register-care/carriers.d.ts +0 -2
  214. package/dist/src/register-care/controlFlow.d.ts +0 -5
  215. package/dist/src/register-care/controlFlow.js +0 -38
  216. package/dist/src/register-care/fix.d.ts +0 -11
  217. package/dist/src/register-care/instruction-shape.d.ts +0 -11
  218. package/dist/src/register-care/instruction-shape.js +0 -129
  219. package/dist/src/register-care/liveness.d.ts +0 -3
  220. package/dist/src/register-care/programModel.d.ts +0 -3
  221. package/dist/src/register-care/programModel.js +0 -266
  222. package/dist/src/register-care/report.d.ts +0 -5
  223. package/dist/src/register-care/routine-summaries.d.ts +0 -6
  224. package/dist/src/register-care/smartComments.d.ts +0 -5
  225. package/dist/src/register-care/smartComments.js +0 -243
  226. package/dist/src/register-care/summaries.d.ts +0 -12
  227. package/dist/src/register-care/summary.d.ts +0 -3
  228. package/dist/src/register-care/summary.js +0 -474
  229. package/dist/src/register-care/tooling.d.ts +0 -43
  230. package/dist/src/register-care/types.d.ts +0 -172
  231. /package/dist/src/{register-care → register-contracts}/accept-output.js +0 -0
  232. /package/dist/src/{register-care → register-contracts}/carriers.js +0 -0
  233. /package/dist/src/{register-care → register-contracts}/sourceText.d.ts +0 -0
  234. /package/dist/src/{register-care → register-contracts}/sourceText.js +0 -0
  235. /package/dist/src/{register-care → register-contracts}/types.js +0 -0
@@ -45,6 +45,16 @@ function buildBoundarySummaryMap(summaries, routineSummaries, profileSummaries)
45
45
  }
46
46
  return boundarySummaryMap;
47
47
  }
48
+ function buildOptimisticInternalBoundarySummaryMap(routines) {
49
+ const out = new Map();
50
+ for (const routine of routines) {
51
+ const summary = emptyRoutineSummary(routine.name);
52
+ for (const label of boundaryLabels(routine)) {
53
+ out.set(label, summary);
54
+ }
55
+ }
56
+ return out;
57
+ }
48
58
  function summarizeRoutines(routines, contracts, boundarySummaryMap = new Map()) {
49
59
  return routines.map((routine) => {
50
60
  const inferred = inferRoutineSummary(routine, boundarySummaryMap);
@@ -73,7 +83,7 @@ function routineSummariesFingerprint(routineSummaries) {
73
83
  return routineSummaries.map((item) => summaryFingerprint(item.summary)).join('\n');
74
84
  }
75
85
  export function inferRoutineSummariesToFixedPoint(routines, contracts, routineNameSet, profileSummaries) {
76
- let routineSummaries = summarizeRoutines(routines, contracts);
86
+ let routineSummaries = summarizeRoutines(routines, contracts, buildOptimisticInternalBoundarySummaryMap(routines));
77
87
  const maxPasses = Math.max(2, routines.length + 2);
78
88
  for (let pass = 0; pass < maxPasses; pass += 1) {
79
89
  const summaries = summariesWithExternalContracts(routineSummaries.map((item) => item.summary), contracts, routineNameSet);
@@ -0,0 +1,5 @@
1
+ import type { LocatedSmartComment, RegisterContractsRoutine } from './types.js';
2
+ export declare function collectPrecedingCommentBlock(routine: RegisterContractsRoutine, sourceTexts: ReadonlyMap<string, string>): {
3
+ comments: LocatedSmartComment[];
4
+ complete: boolean;
5
+ };
@@ -0,0 +1,30 @@
1
+ import { isCompactSourceCommentLine, parseSmartCommentLine } from './smartCommentParsing.js';
2
+ function isCommentOnlyLine(line) {
3
+ return /^\s*;/.test(line);
4
+ }
5
+ export function collectPrecedingCommentBlock(routine, sourceTexts) {
6
+ const source = sourceTexts.get(routine.span.file);
7
+ if (source === undefined)
8
+ return { comments: [], complete: false };
9
+ const lines = source.split(/\r?\n/);
10
+ const rawBlock = [];
11
+ for (let index = routine.span.start.line - 2; index >= 0; index -= 1) {
12
+ const text = lines[index] ?? '';
13
+ if (!isCommentOnlyLine(text))
14
+ break;
15
+ rawBlock.push({ line: index + 1, text });
16
+ }
17
+ rawBlock.reverse();
18
+ let compactStart = rawBlock.length;
19
+ while (compactStart > 0 && isCompactSourceCommentLine(rawBlock[compactStart - 1]?.text ?? '')) {
20
+ compactStart -= 1;
21
+ }
22
+ const relevantBlock = compactStart < rawBlock.length ? rawBlock.slice(compactStart) : rawBlock;
23
+ return {
24
+ complete: compactStart < rawBlock.length,
25
+ comments: relevantBlock.flatMap((item) => {
26
+ const parsed = parseSmartCommentLine(item.text);
27
+ return parsed ? [{ file: routine.span.file, line: item.line, comment: parsed }] : [];
28
+ }),
29
+ };
30
+ }
@@ -0,0 +1,3 @@
1
+ import type { SmartComment } from './types.js';
2
+ export declare function parseSmartCommentLine(line: string): SmartComment | undefined;
3
+ export declare function isCompactSourceCommentLine(line: string): boolean;
@@ -0,0 +1,80 @@
1
+ import { expandCarrierList } from './carriers.js';
2
+ const COMPACT_SOURCE_TAG_RE = /^;?\s*!\s*(in|out|clobbers|preserves)(?:\s+(.+))?$/i;
3
+ const COMPACT_SOURCE_LINE_RE = /^\s*;\s*!\s*(?:in|out|maybe-out|clobbers|preserves)(?:\s|$)/i;
4
+ const CARRIER_RE = /^\{([^}]+)\}(?:\s+(.+))?$/;
5
+ const CONTRACT_COMMENT_KINDS = new Set(['in', 'out', 'clobbers', 'preserves']);
6
+ function parseCarrierPayload(rest) {
7
+ if (!rest)
8
+ return undefined;
9
+ const match = CARRIER_RE.exec(rest.trim());
10
+ if (match) {
11
+ const carriers = match[1]
12
+ .split(',')
13
+ .map((value) => value.trim())
14
+ .filter(Boolean);
15
+ const name = match[2]?.trim();
16
+ return { carriers, ...(name ? { name } : {}) };
17
+ }
18
+ const tokens = rest.trim().split(/\s+/u);
19
+ const carriers = [];
20
+ let consumed = 0;
21
+ for (const token of tokens) {
22
+ const cleaned = token.replace(/[.:;]+$/u, '');
23
+ const parts = cleaned
24
+ .split(',')
25
+ .map((value) => value.trim())
26
+ .filter(Boolean);
27
+ if (parts.length === 0 || !expandCarrierList(parts))
28
+ break;
29
+ carriers.push(...parts);
30
+ consumed += 1;
31
+ }
32
+ if (carriers.length === 0)
33
+ return undefined;
34
+ const name = tokens.slice(consumed).join(' ').trim();
35
+ return { carriers, ...(name ? { name } : {}) };
36
+ }
37
+ export function parseSmartCommentLine(line) {
38
+ const trimmed = line.trim();
39
+ const expectOut = parseExpectOutComment(trimmed);
40
+ if (expectOut !== undefined)
41
+ return expectOut;
42
+ const match = COMPACT_SOURCE_TAG_RE.exec(trimmed);
43
+ if (!match)
44
+ return undefined;
45
+ const tag = match[1].toLowerCase();
46
+ if (!CONTRACT_COMMENT_KINDS.has(tag))
47
+ return undefined;
48
+ return parseCarrierComment(tag, match[2]?.trim());
49
+ }
50
+ function parseExpectOutComment(trimmed) {
51
+ const expectOut = /^;?\s*expects\s+out\s+(.+)$/i.exec(trimmed);
52
+ if (expectOut === null)
53
+ return undefined;
54
+ return parseCarrierComment('expectOut', expectOut[1]?.trim());
55
+ }
56
+ function parseCarrierComment(kind, rest) {
57
+ const payload = parseCarrierPayload(rest);
58
+ if (!payload)
59
+ return undefined;
60
+ const carriers = expandCarrierList(payload.carriers);
61
+ if (!carriers || carriers.length === 0)
62
+ return undefined;
63
+ return buildCarrierComment(kind, carriers, payload.name);
64
+ }
65
+ function buildCarrierComment(kind, carriers, name) {
66
+ if (isUnnamedCarrierCommentKind(kind))
67
+ return { kind, carriers };
68
+ if (isNamedCarrierCommentKind(kind))
69
+ return { kind, carriers, ...(name ? { name } : {}) };
70
+ return undefined;
71
+ }
72
+ function isUnnamedCarrierCommentKind(kind) {
73
+ return kind === 'clobbers' || kind === 'preserves';
74
+ }
75
+ function isNamedCarrierCommentKind(kind) {
76
+ return kind === 'in' || kind === 'out' || kind === 'expectOut';
77
+ }
78
+ export function isCompactSourceCommentLine(line) {
79
+ return COMPACT_SOURCE_LINE_RE.test(line);
80
+ }
@@ -0,0 +1,5 @@
1
+ import type { LocatedSmartComment, RegisterContractsRoutine, RoutineContract } from './types.js';
2
+ import { parseSmartCommentLine } from './smartCommentParsing.js';
3
+ export { parseSmartCommentLine };
4
+ export declare function parseSmartComments(sourceLineComments: ReadonlyMap<string, ReadonlyMap<number, string>>): LocatedSmartComment[];
5
+ export declare function buildRoutineContracts(comments: LocatedSmartComment[], routines?: RegisterContractsRoutine[], sourceTexts?: ReadonlyMap<string, string>): Map<string, RoutineContract>;
@@ -0,0 +1,92 @@
1
+ import { collectPrecedingCommentBlock } from './smartCommentBlocks.js';
2
+ import { parseSmartCommentLine } from './smartCommentParsing.js';
3
+ export { parseSmartCommentLine };
4
+ export function parseSmartComments(sourceLineComments) {
5
+ const out = [];
6
+ for (const [file, comments] of sourceLineComments) {
7
+ for (const [line, text] of comments) {
8
+ const parsed = parseSmartCommentLine(`;${text}`);
9
+ if (parsed) {
10
+ out.push({ file, line, comment: parsed });
11
+ }
12
+ }
13
+ }
14
+ return out.sort((a, b) => (a.file === b.file ? a.line - b.line : a.file.localeCompare(b.file)));
15
+ }
16
+ function appendUnique(items, values) {
17
+ for (const value of values) {
18
+ if (!items.includes(value)) {
19
+ items.push(value);
20
+ }
21
+ }
22
+ }
23
+ function applyContractComment(contract, comment) {
24
+ if (comment.kind === 'in')
25
+ appendUnique(contract.in, comment.carriers);
26
+ if (comment.kind === 'out')
27
+ appendUnique(contract.out, comment.carriers);
28
+ if (comment.kind === 'clobbers')
29
+ appendUnique(contract.clobbers, comment.carriers);
30
+ if (comment.kind === 'preserves')
31
+ appendUnique(contract.preserves, comment.carriers);
32
+ }
33
+ function hasContractContent(contract) {
34
+ return (contract.in.length > 0 ||
35
+ contract.out.length > 0 ||
36
+ contract.clobbers.length > 0 ||
37
+ contract.preserves.length > 0);
38
+ }
39
+ function buildImplicitRoutineContracts(routines, sourceTexts) {
40
+ const contracts = new Map();
41
+ for (const routine of routines) {
42
+ const docBlock = collectPrecedingCommentBlock(routine, sourceTexts);
43
+ if (docBlock.comments.some((item) => item.comment.kind === 'extern' || item.comment.kind === 'end')) {
44
+ continue;
45
+ }
46
+ const contract = {
47
+ name: routine.name,
48
+ in: [],
49
+ out: [],
50
+ clobbers: [],
51
+ preserves: [],
52
+ ...(docBlock.complete ? { complete: true } : {}),
53
+ };
54
+ for (const item of docBlock.comments) {
55
+ applyContractComment(contract, item.comment);
56
+ }
57
+ if (hasContractContent(contract)) {
58
+ contracts.set(routine.name, contract);
59
+ }
60
+ }
61
+ return contracts;
62
+ }
63
+ export function buildRoutineContracts(comments, routines = [], sourceTexts = new Map()) {
64
+ const contracts = new Map();
65
+ let current;
66
+ for (const item of comments) {
67
+ if (item.comment.kind === 'extern') {
68
+ current = {
69
+ name: item.comment.name,
70
+ in: [],
71
+ out: [],
72
+ clobbers: [],
73
+ preserves: [],
74
+ };
75
+ contracts.set(item.comment.name, current);
76
+ continue;
77
+ }
78
+ if (item.comment.kind === 'end') {
79
+ current = undefined;
80
+ continue;
81
+ }
82
+ if (current !== undefined) {
83
+ applyContractComment(current, item.comment);
84
+ }
85
+ }
86
+ for (const [name, contract] of buildImplicitRoutineContracts(routines, sourceTexts)) {
87
+ if (!contracts.has(name)) {
88
+ contracts.set(name, contract);
89
+ }
90
+ }
91
+ return contracts;
92
+ }
@@ -0,0 +1,12 @@
1
+ import type { Diagnostic } from '../model/diagnostic.js';
2
+ import type { AnalyzeRegisterContractsOptions, RegisterContractsDirectCall, RegisterContractsRoutine, RoutineContract, RoutineSummary, RegisterContractsUnit, RegisterContractsOutputCandidate } from './types.js';
3
+ export declare function buildProfileSummaries(profileName: AnalyzeRegisterContractsOptions['registerContractsProfile']): RoutineSummary[];
4
+ export declare function buildProfileSummaryLookup(profileName: AnalyzeRegisterContractsOptions['registerContractsProfile']): Map<string, RoutineSummary>;
5
+ export declare function routineNames(routines: readonly RegisterContractsRoutine[]): string[];
6
+ export declare function buildSummaries(routines: readonly RegisterContractsRoutine[], contractMap: Map<string, RoutineContract>, profileSummaries?: readonly RoutineSummary[]): RoutineSummary[];
7
+ export declare function buildSummaryByName(routines: readonly RegisterContractsRoutine[], summaries: readonly RoutineSummary[], profileSummaries?: readonly RoutineSummary[]): Map<string, RoutineSummary>;
8
+ export declare function withAcceptedOutputs(summaries: readonly RoutineSummary[], acceptedOutputCandidates: ReadonlyMap<string, RegisterContractsUnit[]> | undefined): RoutineSummary[];
9
+ export declare function unknownBoundaryDiagnostics(directBoundaries: readonly RegisterContractsDirectCall[], knownRoutines: ReadonlySet<string>, severity?: Diagnostic['severity']): Diagnostic[];
10
+ export declare function unknownCallList(directBoundaries: readonly RegisterContractsDirectCall[], knownRoutines: ReadonlySet<string>): string[];
11
+ export declare function buildOutputCandidateFixability(routines: readonly RegisterContractsRoutine[], outputCandidates: readonly RegisterContractsOutputCandidate[], autoFixableCandidateKeys: (routines: RegisterContractsRoutine[], outputCandidates: RegisterContractsOutputCandidate[]) => ReadonlySet<string>): ReadonlyMap<string, boolean>;
12
+ export declare function outputCandidateKey(file: string, line: number, column: number): string;
@@ -1,4 +1,4 @@
1
- import { getRegisterCareProfile } from './profiles.js';
1
+ import { getRegisterContractsProfile } from './profiles.js';
2
2
  import { inferRoutineSummariesToFixedPoint, summariesWithExternalContracts, } from './routine-summaries.js';
3
3
  function unique(values) {
4
4
  const out = [];
@@ -20,7 +20,7 @@ function routineNameSet(routines) {
20
20
  return new Set(routines.flatMap((routine) => boundaryLabels(routine)));
21
21
  }
22
22
  export function buildProfileSummaries(profileName) {
23
- const profile = getRegisterCareProfile(profileName);
23
+ const profile = getRegisterContractsProfile(profileName);
24
24
  if (profile === undefined) {
25
25
  return [];
26
26
  }
@@ -33,7 +33,7 @@ export function buildProfileSummaries(profileName) {
33
33
  ];
34
34
  }
35
35
  export function buildProfileSummaryLookup(profileName) {
36
- const profile = getRegisterCareProfile(profileName);
36
+ const profile = getRegisterContractsProfile(profileName);
37
37
  const out = new Map();
38
38
  if (profile === undefined)
39
39
  return out;
@@ -104,13 +104,13 @@ export function withAcceptedOutputs(summaries, acceptedOutputCandidates) {
104
104
  return { ...summary, valueRelations };
105
105
  });
106
106
  }
107
- export function unknownBoundaryDiagnostics(directBoundaries, knownRoutines) {
107
+ export function unknownBoundaryDiagnostics(directBoundaries, knownRoutines, severity = 'warning') {
108
108
  return directBoundaries
109
109
  .filter((boundary) => !knownRoutines.has(boundary.target))
110
110
  .map((boundary) => ({
111
- severity: 'warning',
112
- code: 'AZMN_REGISTER_CARE',
113
- message: `Register-care cannot prove ${boundary.subject}; add a routine body or .asmi extern contract.`,
111
+ severity,
112
+ code: 'AZMN_REGISTER_CONTRACTS',
113
+ message: `Register contracts cannot prove ${boundary.subject}; add a routine body or .asmi extern contract.`,
114
114
  sourceName: boundary.file,
115
115
  line: boundary.line,
116
116
  column: boundary.column,
@@ -0,0 +1,2 @@
1
+ import type { RegisterContractsRoutine, RoutineSummary } from './types.js';
2
+ export declare function boundarySummary(routine: RegisterContractsRoutine, index: number, summaries: ReadonlyMap<string, RoutineSummary>): RoutineSummary | undefined;
@@ -0,0 +1,40 @@
1
+ import { getZ80InstructionEffect } from '../z80/effects.js';
2
+ import { precedingCServiceName } from './boundaryHints.js';
3
+ import { instructionHead } from './instruction-head.js';
4
+ import { rstServiceTargetName, rstTargetName } from './profiles.js';
5
+ export function boundarySummary(routine, index, summaries) {
6
+ const item = routine.instructions[index];
7
+ if (!item)
8
+ return undefined;
9
+ const effect = getZ80InstructionEffect(item.instruction);
10
+ return (callBoundarySummary(effect, summaries) ??
11
+ jumpBoundarySummary(routine, item, effect, summaries) ??
12
+ rstBoundarySummary(routine, index, effect, summaries));
13
+ }
14
+ function callBoundarySummary(effect, summaries) {
15
+ return effect.control.kind === 'call' && effect.control.target
16
+ ? summaries.get(effect.control.target)
17
+ : undefined;
18
+ }
19
+ function jumpBoundarySummary(routine, item, effect, summaries) {
20
+ return isExternalTailJump(routine, item, effect)
21
+ ? summaries.get(effect.control.target)
22
+ : undefined;
23
+ }
24
+ function isExternalTailJump(routine, item, effect) {
25
+ return (effect.control.kind === 'jump' &&
26
+ (instructionHead(item) === 'jp' || instructionHead(item) === 'jp-cc') &&
27
+ effect.control.target !== undefined &&
28
+ !effect.control.target.startsWith('.') &&
29
+ !routine.labels.includes(effect.control.target));
30
+ }
31
+ function rstBoundarySummary(routine, index, effect, summaries) {
32
+ if (effect.control.kind !== 'rst' || effect.control.vector === undefined)
33
+ return undefined;
34
+ return (rstServiceBoundarySummary(routine, index, effect.control.vector, summaries) ??
35
+ summaries.get(rstTargetName(effect.control.vector)));
36
+ }
37
+ function rstServiceBoundarySummary(routine, index, vector, summaries) {
38
+ const service = precedingCServiceName(routine.instructions[index - 1]);
39
+ return service ? summaries.get(rstServiceTargetName(vector, service)) : undefined;
40
+ }
@@ -0,0 +1,2 @@
1
+ import type { RoutineContract, RoutineSummary } from './types.js';
2
+ export declare function applyRoutineContract(summary: RoutineSummary, contract: RoutineContract): RoutineSummary;
@@ -0,0 +1,45 @@
1
+ import { FLAG_UNIT_LIST, contractOutRelation, unique, withImpliedFlagUnits, } from './summary-state.js';
2
+ function relationKey(relation) {
3
+ return `${relation.out.join(',')}<- ${relation.from.join(',')}`;
4
+ }
5
+ function addContractRelation(out, relation) {
6
+ if (relation.out.length === 0)
7
+ return;
8
+ const key = relationKey(relation);
9
+ if (!out.some((existing) => relationKey(existing) === key))
10
+ out.push(relation);
11
+ }
12
+ export function applyRoutineContract(summary, contract) {
13
+ const contractIn = withImpliedFlagUnits(contract.in);
14
+ const contractOut = withImpliedFlagUnits(contract.out);
15
+ const contractClobbers = withImpliedFlagUnits(contract.clobbers);
16
+ const contractPreserves = withImpliedFlagUnits(contract.preserves);
17
+ const outputSet = new Set(contractOut);
18
+ const preservedSet = new Set(contractPreserves);
19
+ const inferredWrites = withImpliedFlagUnits(summary.mayWrite);
20
+ const baseMayWrite = contract.complete
21
+ ? inferredWrites.filter((unit) => FLAG_UNIT_LIST.includes(unit))
22
+ : inferredWrites;
23
+ const mayWrite = baseMayWrite.filter((unit) => !outputSet.has(unit) && !preservedSet.has(unit));
24
+ appendContractClobbers(mayWrite, contractClobbers, outputSet, preservedSet);
25
+ const mayWriteSet = new Set(withImpliedFlagUnits(mayWrite));
26
+ const preserved = unique([...summary.preserved, ...contractPreserves]).filter((unit) => !outputSet.has(unit) && !mayWriteSet.has(unit));
27
+ const valueRelations = [...summary.valueRelations];
28
+ const relation = contractOutRelation(contractIn, contractOut);
29
+ if (relation)
30
+ addContractRelation(valueRelations, relation);
31
+ return {
32
+ ...summary,
33
+ mayRead: unique(contractIn),
34
+ mayWrite,
35
+ preserved,
36
+ valueRelations,
37
+ };
38
+ }
39
+ function appendContractClobbers(mayWrite, contractClobbers, outputSet, preservedSet) {
40
+ for (const unit of contractClobbers) {
41
+ if (!outputSet.has(unit) && !preservedSet.has(unit) && !mayWrite.includes(unit)) {
42
+ mayWrite.push(unit);
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,7 @@
1
+ import { type Token } from './summary-state.js';
2
+ import type { RegisterContractsRoutine, RegisterContractsUnit, RoutineSummary } from './types.js';
3
+ export interface RoutineInferenceStackState {
4
+ stackBalanced: boolean;
5
+ hasUnknownStackEffect: boolean;
6
+ }
7
+ export declare function buildRoutineSummary(routine: RegisterContractsRoutine, tokens: ReadonlyMap<RegisterContractsUnit, Token>, consumedProduced: ReadonlySet<RegisterContractsUnit>, intendedProduced: ReadonlySet<RegisterContractsUnit>, directMayWrite: readonly RegisterContractsUnit[], mayRead: RegisterContractsUnit[], stackState: RoutineInferenceStackState): RoutineSummary;
@@ -0,0 +1,122 @@
1
+ import { CONTRACT_FLAG_UNITS, GENERAL_REGISTER_UNITS, REGISTER_PAIRS, TRACKED_UNITS, tokenPreservesUnit, unique, } from './summary-state.js';
2
+ function relationKey(relation) {
3
+ return `${relation.out.join(',')}<- ${relation.from.join(',')}`;
4
+ }
5
+ function addRelation(out, relation) {
6
+ if (relation.out.length === 0 || relation.from.length === 0)
7
+ return;
8
+ const key = relationKey(relation);
9
+ if (!out.some((existing) => relationKey(existing) === key))
10
+ out.push(relation);
11
+ }
12
+ function addContractRelation(out, relation) {
13
+ if (relation.out.length === 0)
14
+ return;
15
+ const key = relationKey(relation);
16
+ if (!out.some((existing) => relationKey(existing) === key))
17
+ out.push(relation);
18
+ }
19
+ function pairRelation(tokens, out) {
20
+ const from = [];
21
+ for (const unit of out) {
22
+ const token = tokens.get(unit);
23
+ if (!token || token.origin === 'unknown' || token.origin === 'produced')
24
+ return undefined;
25
+ from.push(token.origin);
26
+ }
27
+ if (out.every((unit, idx) => unit === from[idx]))
28
+ return undefined;
29
+ if (out.some((unit, idx) => unit === from[idx]))
30
+ return undefined;
31
+ return { out, from };
32
+ }
33
+ function producedPairRelation(tokens, consumedProduced, out) {
34
+ if (out.some((unit) => tokens.get(unit)?.origin !== 'produced' || consumedProduced.has(unit))) {
35
+ return undefined;
36
+ }
37
+ return { out, from: [] };
38
+ }
39
+ function addProducedPairOutputs(valueRelations, outputUnits, tokens, consumedProduced) {
40
+ for (const pair of REGISTER_PAIRS) {
41
+ const relation = producedPairRelation(tokens, consumedProduced, pair);
42
+ if (!relation)
43
+ continue;
44
+ addContractRelation(valueRelations, relation);
45
+ for (const unit of pair)
46
+ outputUnits.add(unit);
47
+ }
48
+ }
49
+ function singleUnitOutputRelation(unit, tokens, consumedProduced, intendedProduced) {
50
+ const current = tokens.get(unit);
51
+ const eligibleProduced = isProducedOutput(unit, current, intendedProduced);
52
+ const eligiblePreservedIntent = isPreservedIntentOutput(unit, current, intendedProduced);
53
+ if (!(eligibleProduced || eligiblePreservedIntent))
54
+ return undefined;
55
+ if (consumedProduced.has(unit))
56
+ return undefined;
57
+ return {
58
+ out: [unit],
59
+ from: eligiblePreservedIntent ? [unit] : [],
60
+ };
61
+ }
62
+ function isProducedOutput(unit, token, intendedProduced) {
63
+ if (token?.origin !== 'produced')
64
+ return false;
65
+ return GENERAL_REGISTER_UNITS.has(unit) || isProducedFlagOutput(unit, intendedProduced);
66
+ }
67
+ function isProducedFlagOutput(unit, intendedProduced) {
68
+ return CONTRACT_FLAG_UNITS.has(unit) && intendedProduced.has(unit);
69
+ }
70
+ function isPreservedIntentOutput(unit, token, intendedProduced) {
71
+ return token?.origin === unit && GENERAL_REGISTER_UNITS.has(unit) && intendedProduced.has(unit);
72
+ }
73
+ function addSingleUnitOutputs(valueRelations, outputUnits, tokens, consumedProduced, intendedProduced) {
74
+ for (const unit of TRACKED_UNITS) {
75
+ if (outputUnits.has(unit))
76
+ continue;
77
+ const relation = singleUnitOutputRelation(unit, tokens, consumedProduced, intendedProduced);
78
+ if (!relation)
79
+ continue;
80
+ addContractRelation(valueRelations, relation);
81
+ outputUnits.add(unit);
82
+ }
83
+ }
84
+ function collectPreservedAndMayWrite(tokens, outputUnits, directMayWrite) {
85
+ const preserved = [];
86
+ const mayWrite = [...directMayWrite];
87
+ for (const unit of TRACKED_UNITS) {
88
+ const current = tokens.get(unit);
89
+ if (tokenPreservesUnit(current, unit)) {
90
+ preserved.push(unit);
91
+ continue;
92
+ }
93
+ if (!outputUnits.has(unit))
94
+ mayWrite.push(unit);
95
+ }
96
+ return { preserved, mayWrite };
97
+ }
98
+ function addValueRelations(valueRelations, tokens) {
99
+ for (const pair of REGISTER_PAIRS) {
100
+ const relation = pairRelation(tokens, pair);
101
+ if (relation)
102
+ addRelation(valueRelations, relation);
103
+ }
104
+ }
105
+ export function buildRoutineSummary(routine, tokens, consumedProduced, intendedProduced, directMayWrite, mayRead, stackState) {
106
+ const valueRelations = [];
107
+ const outputUnits = new Set();
108
+ addProducedPairOutputs(valueRelations, outputUnits, tokens, consumedProduced);
109
+ addSingleUnitOutputs(valueRelations, outputUnits, tokens, consumedProduced, intendedProduced);
110
+ const { preserved, mayWrite } = collectPreservedAndMayWrite(tokens, outputUnits, directMayWrite);
111
+ addValueRelations(valueRelations, tokens);
112
+ mayRead.push(...valueRelations.flatMap((relation) => relation.from));
113
+ return {
114
+ name: routine.name,
115
+ mayRead: unique(mayRead),
116
+ mayWrite: unique(mayWrite),
117
+ preserved: unique(preserved),
118
+ valueRelations,
119
+ stackBalanced: stackState.stackBalanced,
120
+ hasUnknownStackEffect: stackState.hasUnknownStackEffect,
121
+ };
122
+ }
@@ -0,0 +1,23 @@
1
+ import type { RegisterContractsInstruction, RegisterContractsUnit, ValueRelation } from './types.js';
2
+ export declare const FLAG_UNIT_LIST: RegisterContractsUnit[];
3
+ export declare const TRACKED_UNITS: RegisterContractsUnit[];
4
+ export declare const GENERAL_REGISTER_UNITS: Set<RegisterContractsUnit>;
5
+ export declare const CONTRACT_FLAG_UNITS: Set<RegisterContractsUnit>;
6
+ export declare const STACK_POINTER_UNITS: Set<RegisterContractsUnit>;
7
+ export declare const REGISTER_PAIRS: RegisterContractsUnit[][];
8
+ export type Token = {
9
+ origin: RegisterContractsUnit;
10
+ } | {
11
+ origin: 'produced';
12
+ } | {
13
+ origin: 'unknown';
14
+ };
15
+ export declare function unique<T>(items: T[]): T[];
16
+ export declare function isTrackedUnit(unit: RegisterContractsUnit): boolean;
17
+ export declare function getRegisterUnits(name: string): RegisterContractsUnit[] | undefined;
18
+ export declare function readToken(tokens: Map<RegisterContractsUnit, Token>, unit: RegisterContractsUnit): Token;
19
+ export declare function semanticReadOrigins(tokens: Map<RegisterContractsUnit, Token>, units: RegisterContractsUnit[]): RegisterContractsUnit[];
20
+ export declare function markProducedReadsConsumed(tokens: Map<RegisterContractsUnit, Token>, consumedProduced: Set<RegisterContractsUnit>, reads: RegisterContractsUnit[], writes: ReadonlySet<RegisterContractsUnit>, item?: RegisterContractsInstruction): void;
21
+ export declare function tokenPreservesUnit(token: Token | undefined, unit: RegisterContractsUnit): boolean;
22
+ export declare function withImpliedFlagUnits(units: RegisterContractsUnit[]): RegisterContractsUnit[];
23
+ export declare function contractOutRelation(contractIn: RegisterContractsUnit[], contractOut: RegisterContractsUnit[]): ValueRelation | undefined;
@@ -0,0 +1,88 @@
1
+ import { expandCarrierList } from './carriers.js';
2
+ import { instructionHead } from './instruction-head.js';
3
+ export const FLAG_UNIT_LIST = [
4
+ 'carry',
5
+ 'zero',
6
+ 'sign',
7
+ 'parity',
8
+ 'halfCarry',
9
+ ];
10
+ export const TRACKED_UNITS = [
11
+ 'A',
12
+ 'B',
13
+ 'C',
14
+ 'D',
15
+ 'E',
16
+ 'H',
17
+ 'L',
18
+ 'IXH',
19
+ 'IXL',
20
+ 'IYH',
21
+ 'IYL',
22
+ ...FLAG_UNIT_LIST,
23
+ ];
24
+ export const GENERAL_REGISTER_UNITS = new Set([
25
+ 'A',
26
+ 'B',
27
+ 'C',
28
+ 'D',
29
+ 'E',
30
+ 'H',
31
+ 'L',
32
+ ]);
33
+ export const CONTRACT_FLAG_UNITS = new Set(['carry', 'zero']);
34
+ export const STACK_POINTER_UNITS = new Set(['SPH', 'SPL']);
35
+ export const REGISTER_PAIRS = [
36
+ ['B', 'C'],
37
+ ['D', 'E'],
38
+ ['H', 'L'],
39
+ ];
40
+ export function unique(items) {
41
+ return [...new Set(items)];
42
+ }
43
+ export function isTrackedUnit(unit) {
44
+ return TRACKED_UNITS.includes(unit);
45
+ }
46
+ export function getRegisterUnits(name) {
47
+ return expandCarrierList([name]);
48
+ }
49
+ export function readToken(tokens, unit) {
50
+ return tokens.get(unit) ?? { origin: 'unknown' };
51
+ }
52
+ export function semanticReadOrigins(tokens, units) {
53
+ const origins = [];
54
+ for (const unit of units) {
55
+ if (!isTrackedUnit(unit)) {
56
+ origins.push(unit);
57
+ continue;
58
+ }
59
+ const token = readToken(tokens, unit);
60
+ if (token.origin !== 'unknown' && token.origin !== 'produced')
61
+ origins.push(token.origin);
62
+ }
63
+ return origins;
64
+ }
65
+ export function markProducedReadsConsumed(tokens, consumedProduced, reads, writes, item) {
66
+ for (const unit of reads) {
67
+ if (!isTrackedUnit(unit) || writes.has(unit))
68
+ continue;
69
+ if (item !== undefined && instructionHead(item) === 'cp' && unit === 'A')
70
+ continue;
71
+ if (readToken(tokens, unit).origin === 'produced')
72
+ consumedProduced.add(unit);
73
+ }
74
+ }
75
+ export function tokenPreservesUnit(token, unit) {
76
+ return token?.origin === unit;
77
+ }
78
+ export function withImpliedFlagUnits(units) {
79
+ return unique(units);
80
+ }
81
+ export function contractOutRelation(contractIn, contractOut) {
82
+ if (contractOut.length === 0)
83
+ return undefined;
84
+ return {
85
+ out: contractOut,
86
+ from: contractIn.length === contractOut.length ? contractIn : [],
87
+ };
88
+ }
@@ -0,0 +1,3 @@
1
+ import { type Token } from './summary-state.js';
2
+ import type { RegisterContractsInstruction, RegisterContractsUnit } from './types.js';
3
+ export declare function applyPureTokenTransfer(tokens: Map<RegisterContractsUnit, Token>, consumedProduced: Set<RegisterContractsUnit>, item: RegisterContractsInstruction): RegisterContractsUnit[];