vyre-reference 0.1.0

Pure-Rust CPU reference interpreter for vyre IR — byte-identical oracle for backend conformance and small-data fallback
Documentation
//! Pure Rust reference interpreter for vyre IR programs.
//!
//! This module is the executable specification for IR semantics. It is
//! intentionally slow and direct: every current IR expression and node variant
//! has a named evaluator function.

/// Dual-reference trait and registry types.
pub mod dual;
/// Re-export of vyre's canonical hash primitives (MD5, SHA1/2/3, BLAKE2/3,
/// RIPEMD160, SipHash, xxHash, HMAC, KDF). The canonical implementations
/// live in `vyre::ops::hash::reference` so that core ops and the IR
/// interpreter agree byte-for-byte; this re-export keeps the
/// `vyre_reference::hash::…` path stable for downstream consumers.
pub use vyre::ops::hash::reference as hash;
/// Operation-specific standalone CPU references.
pub mod primitive;
/// Runtime value representation for interpreter inputs and outputs.
pub mod value;

/// Atomic operation reference implementations.
pub mod atomics;
/// CPU operation traits used by concrete reference implementations.
pub mod cpu_op;
/// Expression evaluator (BinOp, UnOp, Load, Call, etc).
pub mod eval_expr;
/// Statement evaluator (Let, Store, If, Loop, Barrier, etc).
pub mod eval_node;
/// Flat byte adapter used by [`crate::cpu_op::CpuOp`].
pub mod flat_cpu;
/// IEEE 754 strict floating-point utilities.
pub mod ieee754;
/// Top-level interpreter entry point and error types.
pub mod interp;
/// Workgroup simulation: invocation IDs, shared memory.
pub mod workgroup;

mod oob;
mod ops;
mod typed_ops;

/// Execute a vyre IR program on the pure Rust reference interpreter.
pub use interp::run;

/// Resolve an operation ID to its two independently-written references.
pub fn resolve_dual(op_id: &str) -> Option<(dual::ReferenceFn, dual::ReferenceFn)> {
    match op_id {
        primitive::bitwise::xor::OP_ID => Some((
            primitive::bitwise::xor::reference_a::reference,
            primitive::bitwise::xor::reference_b::reference,
        )),
        _ => None,
    }
}

/// Return the complete list of operation IDs that have dual references registered.
///
/// This is the canonical enumeration used by the differential fuzzing gate.
/// Every new dual-reference pair MUST add its OP_ID here.
pub fn dual_op_ids() -> &'static [&'static str] {
    &[primitive::bitwise::xor::OP_ID]
}