This commit is contained in:
Nilton Constantino
2026-01-31 17:45:31 +00:00
parent 13e58a8efd
commit 9fa337687f
5 changed files with 361 additions and 104 deletions
-56
View File
@@ -1,37 +1,3 @@
## PR-05 — Core arithmetic + comparisons in VM (int/bounded/bool)
**Why:** The minimal executable PBS needs arithmetic that doesn’t corrupt stack.
### Scope
* Implement v0 numeric opcodes (slot-safe):
* `IADD, ISUB, IMUL, IDIV, IMOD`
* `ICMP_EQ, ICMP_NE, ICMP_LT, ICMP_LE, ICMP_GT, ICMP_GE`
* `BADD, BSUB, ...` (or unify with tagged values)
* Define conversion opcodes if lowering expects them:
* `BOUND_TO_INT`, `INT_TO_BOUND_CHECKED` (trap OOB)
### Deliverables
* Deterministic traps:
* `TRAP_DIV_ZERO`
* `TRAP_OOB` (bounded checks)
### Tests
* simple arithmetic chain
* div by zero traps
* bounded conversions trap on overflow
### Acceptance
* Arithmetic and comparisons are closed and verified.
---
## PR-06 — Control flow opcodes: jumps, conditional branches, structured “if”
**Why:** `if` must be predictable and verifier-safe.
@@ -263,28 +229,6 @@
---
# Work split (what can be parallel later)
* VM core correctness: PR-01..PR-08 (sequential, contract-first)
* Debug + tooling: PR-09, PR-12 (parallel after PR-03)
* Linking/imports: PR-10 (parallel after PR-01)
* Canonical cartridge: PR-11 (parallel after PR-05)
---
# “Stop the line” rules
1. If a PR introduces an opcode without stack spec + verifier integration, it’s rejected.
2. If a PR changes bytecode layout without bumping version, it’s rejected.
3. If a PR adds a feature before the canonical cartridge passes, it’s rejected.
---
# First implementation target (tomorrow morning, start here)
**Start with PR-02 (Opcode spec + verifier)** even if you think you already know the bug.
Once the verifier exists, the rest becomes mechanical: every failure becomes *actionable*.
## Definition of Done (DoD) for PBS v0 “minimum executable”
A single canonical cartridge runs end-to-end: