v5 Capstone
Full pipeline
Lex -> Parse -> Analyze -> CompileModules -> Link -> Encode/Decode -> VM
Stage ownership
- parser builds AST, no linking assumptions
- analyzer validates modules/types/errors only
- compiler emits module artifacts
- linker rewrites/merges
- decode validates artifact compatibility
- VM executes merged bytecode
Error policy
- stage-order precedence: parse > semantic > compile/link/encode/decode > runtime
- analyzer returns many internally, capstone returns first deterministic one
Why encode/decode in path
- catches boundary drift before runtime
- ensures artifact readability
- keeps external tooling compatibility
Determinism
- preserve module and export order
- stable linker rebasing
- same source -> same encode/decode/execute behavior
Practical checks
- module import/export validation happens before runtime
mainremains entry module path in linked program- no state leakage across VM runs
- only execution failures remain once earlier stages pass
1 / 1