Expand description
Field-level parser helpers wired into #[derive(vihaco_parser::Parse)] via
#[parse_with = "..."] on the vihaco_cpu::Instruction enum.
Scope intentionally narrow: the helpers cover only the subset that
#[derive(Parse)] can model cleanly. Three families of variants are
deferred to the Module orchestrator (Item 4 of the migration plan):
Const(Value::String/FunctionRef/HeapRef)— needs a shared string interner / symbol table thatParsehas no way to thread through.cpu_const_value()parses only the numeric/bool flavours.Branch,ConditionalBranch,Call— use symbolic@labeltargets in real.sstsource; the symbol table lives in the orchestrator. Thenever_u32()helper guaranteesInstruction::parser()errors out on these mnemonics so the orchestrator can dispatch first.- Conversion from the parse-time numeric form to the orchestrator-resolved
form is tracked in
~/.claude/plans/vihaco-future-rawvalue-refactor.md.
Functions§
- cpu_
const_ value - Parses the body of
const.<type> <literal>— without the leadingconstkeyword (the derive macro emits that). Numeric and bool variants only. - cpu_
type - Parses
.<typename>and returns the matching [Type]. Used for the typed arithmetic/comparison variants —add.i64,lt.u64, etc. - never_
u32 - A parser that always fails. Used for variant operands whose real form is a
symbolic
@label(Branch,ConditionalBranch,Call). Letting these fall through here meansInstruction::parser()errors on their mnemonics, which is correct — the orchestrator must intercept first.