Expand description
Loaded program state and host access to section-local code and metadata.
Equal string contents reuse the same section-local index:
use vihaco_runtime::{Lower, Parse, Syntax, chumsky::Parser as _};
use vihaco_bytecode::NoContext;
use vihaco_stdlib::ProgramImage;
use vihaco_cpu::cpu;
let mut image = ProgramImage::<(), NoContext>::default();
for _ in 0..2 {
let source = cpu::ConstString::<Syntax>::parser().parse("const_string \"hello\"")
.into_result().unwrap();
assert_eq!(source.lower(&mut image).unwrap(), cpu::ConstString(0));
}
assert_eq!(image.module.strings, ["hello"]);Modules§
- lower
- Instruction-owned program lowering, separate from the dialect definitions.
- operand
- Retained syntax operands for program lowering.
- program
Structs§
- Program
Image - A loaded section, its shared context, and current program counter.