-
Notifications
You must be signed in to change notification settings - Fork 0
Command Authoring
Pt edited this page Jun 17, 2026
·
2 revisions
This page describes production-grade handler design for both String and Byte engines.
func(*engine.StringEngine, stringParsing.ParsedNode) errorfunc(*engine.ByteEngine, byteParsing.ParsedBytes) error- Deterministic behavior for identical inputs.
- Explicit validation before execution.
- Minimal hidden side effects.
- Clear error messages with command context.
- Stable writes to known pipeline points.
- Decode and validate node metadata/args.
- Resolve runtime dependencies from scope.
- Execute semantic action.
- Emit output via generator.
- Return contextual error on failure.
- Command identity comes from
ParsedNode.Switch. - Metadata schema should be parser-defined and versioned.
- Unknown command behavior should be explicit at integration layer.
- Decode binary args by your contract.
- For control flow instructions:
- disable auto shift for that opcode,
- mutate bytecode pointer manually.
- Make pointer movement explicit and testable.
Prefer:
- domain errors,
- wrapped context (
fmt.Errorf("cmd <name>: %w", err)).
Avoid:
- panics in normal runtime paths,
- silent no-op behavior for critical commands.