@jhlagado/azm 0.2.0 → 0.2.1

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 (36) hide show
  1. package/README.md +95 -70
  2. package/dist/src/api-compile.js +1 -1
  3. package/dist/src/assembly/address-planning.js +2 -0
  4. package/dist/src/assembly/program-emission.js +1 -0
  5. package/dist/src/expansion/op-expansion.js +1 -0
  6. package/dist/src/model/source-item.d.ts +6 -0
  7. package/dist/src/outputs/write-asm80.js +122 -5
  8. package/dist/src/register-care/analyze.js +36 -8
  9. package/dist/src/register-care/annotate.d.ts +11 -0
  10. package/dist/src/register-care/annotate.js +76 -0
  11. package/dist/src/register-care/annotations.js +33 -146
  12. package/dist/src/register-care/fix.d.ts +2 -0
  13. package/dist/src/register-care/fix.js +52 -0
  14. package/dist/src/register-care/instruction-shape.d.ts +11 -0
  15. package/dist/src/register-care/instruction-shape.js +129 -0
  16. package/dist/src/register-care/liveness.js +15 -7
  17. package/dist/src/register-care/profiles.js +4 -0
  18. package/dist/src/register-care/programModel.js +79 -13
  19. package/dist/src/register-care/report.d.ts +2 -1
  20. package/dist/src/register-care/report.js +91 -34
  21. package/dist/src/register-care/routine-summaries.d.ts +6 -0
  22. package/dist/src/register-care/routine-summaries.js +89 -0
  23. package/dist/src/register-care/sourceText.d.ts +8 -0
  24. package/dist/src/register-care/sourceText.js +15 -0
  25. package/dist/src/register-care/summaries.d.ts +3 -3
  26. package/dist/src/register-care/summaries.js +42 -75
  27. package/dist/src/register-care/summary.d.ts +3 -0
  28. package/dist/src/register-care/summary.js +474 -0
  29. package/dist/src/register-care/types.d.ts +6 -1
  30. package/dist/src/source/strip-line-comment.d.ts +2 -0
  31. package/dist/src/source/strip-line-comment.js +26 -0
  32. package/dist/src/syntax/parse-diagnostics.d.ts +12 -0
  33. package/dist/src/syntax/parse-diagnostics.js +18 -0
  34. package/dist/src/syntax/parse-line.js +63 -10
  35. package/docs/reference/tooling-api.md +13 -6
  36. package/package.json +4 -2
@@ -89,7 +89,9 @@ The integration contract is:
89
89
  - `compile()` returns artifacts in memory; the CLI is only responsible for
90
90
  writing those artifacts to disk
91
91
  - Debug80 should consume the `d8m` artifact for source/address metadata and the
92
- `bin` or `hex` artifact for loadable bytes
92
+ `bin` artifact for loadable bytes (hex is acceptable when bin is not emitted)
93
+ - Do not rely on lowered `.z80` for Debug80 integration until asm80 coverage is
94
+ complete; use **bin + d8m** as the supported debugger path
93
95
  - pass `sourceRoot` so D8 file keys are stable project-relative source paths
94
96
  rather than basename-only paths
95
97
  - pass `d8mInputs` when Debug80 knows the intended artifact paths; AZM records
@@ -252,6 +254,12 @@ const result = await compile(
252
254
  );
253
255
  ```
254
256
 
257
+ **`emitAsm80` caveat:** Lowered `.z80` emission is gated but not universal.
258
+ Unsupported instructions or operand forms throw `UnsupportedAsm80LoweringError`,
259
+ surfaced as `AZMN_ASM80`. When assembly already succeeded, `compile()` still
260
+ returns bin/hex/d8/listing artifacts alongside the asm80 error. Run
261
+ `npm run check:asm80-coverage` on your sources before relying on lowered output.
262
+
255
263
  The compiler accepts flat `.asm` / `.z80` source, retained AZM assembler
256
264
  features, and the same output writers used by the CLI. External register-care
257
265
  interfaces are `.asmi` metadata files, not compile entry files.
@@ -270,20 +278,19 @@ generated frames are outside this API contract for AZM source.
270
278
  The public tooling surface includes:
271
279
 
272
280
  - `Diagnostic`, `DiagnosticIds`, severity/id types
273
- - `SourcePosition`, `SourceSpan`
274
- - `ProgramNode`, `SourceFileNode`, `SourceItemNode`
275
281
  - `LoadedProgram`
276
- - `CompileEnv`
282
+ - `AnalyzeProgramResult`, `LoadProgramResult`
277
283
  - `RegisterCareCandidateDiagnostic`, `RegisterCareCodeAction`, `RegisterCareOutputCandidate`
278
284
 
279
- In v1, the AST exported from `src/frontend/ast.ts` is part of the public contract. Additive fields are minor-version changes; breaking shape changes are major-version changes.
285
+ The public tooling contract is the package export surface, not deep internal
286
+ paths. Do not document retired internal modules as public API.
280
287
 
281
288
  ## Syntax Highlighting Example
282
289
 
283
290
  Syntax colouring is an example consumer of the tooling API:
284
291
 
285
292
  1. Call `loadProgram()` with the file path and optional unsaved buffer text.
286
- 2. Walk `ProgramNode` and inspect `node.kind` plus `node.span`.
293
+ 2. Walk `loadedProgram.program.files[0].items` and inspect each item's `kind` and `span`.
287
294
  3. Map those spans to TextMate scopes or semantic token kinds in the editor.
288
295
  4. Fall back to regex/TextMate-only colouring if parsing fails or the editor needs a cheaper fast path.
289
296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhlagado/azm",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AZM assembler for the Z80 family (Node.js CLI)",
5
5
  "license": "GPL-3.0-only",
6
6
  "engines": {
@@ -72,7 +72,9 @@
72
72
  "test:coverage": "vitest run --coverage",
73
73
  "test:ci:coverage-core": "node scripts/dev/run-coverage-core.mjs",
74
74
  "test:ci:slow-reliability": "vitest run --no-file-parallelism --maxWorkers=1 --minWorkers=1 --testTimeout=20000 --hookTimeout=300000 test/cli test/cli_*.test.ts",
75
+ "test:ci:asm80-parity": "node scripts/ci/run-asm80-parity.mjs",
75
76
  "check:fixture-coverage": "node scripts/dev/check-fixture-coverage.mjs",
77
+ "check:asm80-coverage": "node scripts/dev/check-asm80-lowering-coverage.mjs",
76
78
  "test:azm:alpha": "node scripts/dev/run-azm-alpha-guardrails.mjs",
77
79
  "test:azm:corpus": "node scripts/dev/run-azm-corpus-guardrails.mjs",
78
80
  "test:package": "npm run build && node scripts/dev/smoke-npm-package.mjs",
@@ -84,7 +86,7 @@
84
86
  "next:typecheck": "tsc -p tsconfig.json --noEmit",
85
87
  "next:test": "vitest run --config vitest.config.ts",
86
88
  "next:check": "npm run next:typecheck && npm run next:test",
87
- "next:guardrails:core": "npm run next:check && npm run next:diff-current:all",
89
+ "next:guardrails:core": "npm run next:check && npm run check:asm80-coverage && npm run next:diff-current:all",
88
90
  "next:guardrails:package": "npm run test:package || npm run next:guardrails:package:local",
89
91
  "next:guardrails:package:local": "npm run build && vitest run -c vitest.config.ts test/integration/stage-16-package-smoke-local.test.ts && vitest run test/public_api_surface.test.ts",
90
92
  "next:guardrails:quality": "npm run lint && npm run check:source-file-sizes && node scripts/check-source-file-sizes.mjs",