lmcode-java
lmcode-java is a zero-dependency Java 21 SDK (package io.lmctl.lmcode) for running lmcode DSLB v6 bytecode on the JVM or GraalVM Native Image. It preserves raw bytes in VmString, installs the 226-signature lmcode_std_v3 catalog, and includes the RestController and InvocationResults APIs.
Quick reference
git clone https://github.com/lmctl-ai/lmcode-java.git
cd lmcode-java
mvn -q verify
./scripts/build-native.sh
| Item | Signature / Value | Role |
|---|---|---|
| new Registry() | io.lmctl.lmcode.Registry | Create a registry preloaded with all 226 lmcode_std_v3 signatures |
| new Registry(false) | io.lmctl.lmcode.Registry | Create an empty host registry without standard library bindings |
| Program.load(bc, schema, reg) | io.lmctl.lmcode.Program | Verify DSLB v6 bytecode, SHA-256 schema hash, imports, and control-flow stack depths |
| program.run(ctx, reg) | void | Execute the verified program body against a Context |
| program.call(idx, ctx, reg, args) | io.lmctl.lmcode.Value | Invoke an R49 rule entry by index with a List<Value> argument vector |
| Rest.registerRest(reg, opts) | io.lmctl.lmcode.rest.RestController | Re-bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller |
| InvocationResults.fromCommand(files) | io.lmctl.lmcode.InvocationResults | Read LMCODE_INVOCATION_FILE, manage per-part ResultSinks, and emit LMCODE_RETURN frames |
import io.lmctl.lmcode.*;
import io.lmctl.lmcode.rest.*;
import java.nio.file.*;
public final class HostMain {
public static void main(String[] args) throws Exception {
Registry reg = new Registry();
RestController rest = Rest.registerRest(reg, new RestOptions().maxBodyBytes(1 << 20));
byte[] bc = Files.readAllBytes(Path.of(args[0]));
byte[] schema = Files.readAllBytes(Path.of(args[1]));
Program prog = Program.load(bc, schema, reg);
rest.run(prog, new Context());
}
}