Spaces:
Sleeping
Sleeping
File size: 2,379 Bytes
463f868 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Bytecode Simplification Plan
## Goal
Keep the useful part of bytecode, a deterministic execution stream, but remove the bitpacking and remove the extra semantic layers we built on top of it.
## Principles
- One instruction model.
- One execution path.
- One choice metadata source.
- No parallel runtime-plan stack.
- No bitfield archaeology for authors or debuggers.
## Target Shape
1. Pseudocode remains the authoring input.
2. The compiler lowers pseudocode into one explicit instruction IR.
3. That IR uses named enums and explicit fields instead of packed bit positions.
4. Rust executes that IR directly.
5. Packed bytecode exists only as a compatibility export or import format, not as the thing we think in.
## What To Remove
- Separate `runtime_plan` as a second semantic representation.
- Duplicate `choice_flags` and `choice_count` derivation paths.
- Launcher and Rust heuristics that infer interaction state from legacy packed values.
- Any code that needs both the old and new models to understand a single ability.
## What To Keep
- The actual opcode sequence ordering.
- The existing Rust handler family that already knows how to resolve effects.
- The parser that turns text into structured ability objects.
- Compatibility conversion for old data until migration is complete.
## Implementation Steps
1. Revert to the bytecode-only baseline and keep the tree stable.
2. Define a single explicit instruction IR with enum-backed fields.
3. Make the compiler emit that IR directly.
4. Add one serializer that can still emit packed bytecode if needed.
5. Make Rust consume the explicit IR first.
6. Keep bytecode only as a fallback boundary, not as a parallel architecture.
7. Add regression tests for choice-heavy cards before removing compatibility code.
8. Delete duplicated semantic or runtime-plan plumbing once parity is proven.
## Success Criteria
- A card can be inspected in one place and understood without bit math.
- Pending interactions render from one prompt contract.
- The Rust engine has one normal path for execution.
- Bytecode is an implementation detail again, not a second architecture.
## Practical Rule
If a new layer does not remove an old layer, it should not survive long-term.
The next simplification should collapse structure, not add another translation pass.
|