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
| Item | Signature / Value | Role |
|---|---|---|
| Registry::new() | dslvm::Registry | Create a typed host registry preloaded with all 226 lmcode_std_v3 canonical signatures |
| Registry::without_std() | dslvm::Registry | Create an empty host registry without standard library bindings |
| Program::load(bc, schema, ®) | dslvm::Program | Verify DSLB v6 bytes and SHA-256 schema digest, bind imports, and validate stack depth |
| program.run(&mut ctx, ®) | Result<(), Error> | Execute the program body against live host objects stored in Context |
| program.call(idx, &mut ctx, ®, &args) | Result<Value, Error> | Invoke a compiled R49 rule entry by index with typed arguments |
| register_rest(&mut reg, opts) | dslvm::rest::RestController | Bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller |
| InvocationResults::from_command(&files) | dslvm::InvocationResults | Read 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, ®istry)?;
let mut ctx = Context::new();
rest.run(&program, ®istry, &mut ctx)?;
Ok(())
}