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
ItemSignature / ValueRole
new Registry()io.lmctl.lmcode.RegistryCreate a registry preloaded with all 226 lmcode_std_v3 signatures
new Registry(false)io.lmctl.lmcode.RegistryCreate an empty host registry without standard library bindings
Program.load(bc, schema, reg)io.lmctl.lmcode.ProgramVerify DSLB v6 bytecode, SHA-256 schema hash, imports, and control-flow stack depths
program.run(ctx, reg)voidExecute the verified program body against a Context
program.call(idx, ctx, reg, args)io.lmctl.lmcode.ValueInvoke an R49 rule entry by index with a List<Value> argument vector
Rest.registerRest(reg, opts)io.lmctl.lmcode.rest.RestControllerRe-bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller
InvocationResults.fromCommand(files)io.lmctl.lmcode.InvocationResultsRead 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());
    }
}

Documentation pages

Source repository and releases