lmcode-rust

lmcode-rust is a zero-dependency Rust SDK (dslvm crate) for loading, verifying, and executing lmcode DSLB v6 bytecode in native Rust hosts. It ships the 226-signature lmcode_std_v3 catalog, the stdio REST and stateless CLI controller, dry-mode callback slots, and the LMCODE_RETURN invocation collector.

Quick reference

git clone https://github.com/lmctl-ai/lmcode-rust.git
cd lmcode-rust
cargo test
cargo run --bin dsl-conformance -- conformance/vectors
ItemSignature / ValueRole
Registry::new()dslvm::RegistryCreate a typed host registry preloaded with all 226 lmcode_std_v3 canonical signatures
Registry::without_std()dslvm::RegistryCreate an empty host registry without standard library bindings
Program::load(bc, schema, &reg)dslvm::ProgramVerify DSLB v6 bytes and SHA-256 schema digest, bind imports, and validate stack depth
program.run(&mut ctx, &reg)Result<(), Error>Execute the program body against live host objects stored in Context
program.call(idx, &mut ctx, &reg, &args)Result<Value, Error>Invoke a compiled R49 rule entry by index with typed arguments
register_rest(&mut reg, opts)dslvm::rest::RestControllerBind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller
InvocationResults::from_command(&files)dslvm::InvocationResultsRead LMCODE_INVOCATION_FILE, manage per-slot ResultSinks, and write LMCODE_RETURN frames
use dslvm::rest::{register_rest, RestOptions};
use dslvm::{Context, Program, Registry, Value};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut registry = Registry::new();
    registry.function("ping", &[], "string", |_ctx, _args| Ok(Value::string("pong")))?;
    let mut rest = register_rest(&mut registry, RestOptions::default())?;
    let schema = include_bytes!("../std/lmcode-std.schema.json");
    let bytecode = std::fs::read("app.dslb")?;
    let program = Program::load(&bytecode, schema, &registry)?;
    let mut ctx = Context::new();
    rest.run(&program, &registry, &mut ctx)?;
    Ok(())
}

Documentation pages

Source repository and releases