Skip to main content

byteflow/bytecode/
mod.rs

1//! Instruction set, `.bf` (BFV0) wire format, assembler and verifier.
2//!
3//! Pure data plane — no threads, no mailboxes. The scheduler and VM consume
4//! [`Chunk`] values produced here.
5//!
6//! | Piece | Purpose |
7//! |-------|---------|
8//! | [`Opcode`] / [`Instruction`] | ISA (opcodes are **append-only**) |
9//! | [`Value`] / [`Message`] | Runtime / constant-pool tags (ABI versioned) |
10//! | [`Program`] / [`Fn`] | Host-side assembler with named registers |
11//! | [`encode`] / [`decode`] | `.bf` module bytes (`MAGIC` + [`ABI_VERSION`]) |
12//! | [`verify`] | Structural checks before a [`crate::Runtime`] starts |
13//!
14//! Current ABI: see [`ABI_VERSION`] (FlowCap + `Str` / `Bytes`).
15
16pub(crate) mod builder;
17mod cap;
18mod chunk;
19mod disasm;
20mod program;
21mod format;
22mod instruction;
23mod macros;
24mod opcode;
25mod value;
26mod verify;
27
28pub use cap::{
29    Cap, CapId, CapIdError, CapRights, CapTarget, NativeIdx, NativeMask, RevocationCell,
30};
31pub use program::{Fn, FuncId, Label, Program, Reg, RegWindow};
32pub use chunk::{Chunk, FunctionDef, ABI_VERSION, MAGIC};
33pub use disasm::disassemble;
34pub use format::{decode, decode_with, encode, FormatError};
35pub use instruction::Instruction;
36pub use macros::asm_macros;
37pub use opcode::Opcode;
38pub use value::{Message, Value, TAG_SYS_DOWN, TAG_SYS_EXIT};
39pub use verify::{verify, verify_with, ConstantKind, TrustLevel, VerifyConfig, VerifyError};