lmcode-csharp

lmcode-csharp is a dependency-free .NET 8 SDK (namespace LmCode) for embedding the lmcode DSLB v6 verifier and VM in managed or NativeAOT C# hosts. It ships the 226-signature lmcode_std_v3 catalog, byte-exact VmString spans, RestCatalog stdio HTTP/CLI controller, and InvocationResults framing.

Quick reference

git clone https://github.com/lmctl-ai/lmcode-csharp.git
cd lmcode-csharp
dotnet build -c Release -warnaserror
dotnet test
ItemSignature / ValueRole
new Registry()LmCode.RegistryCreate a registry preloaded with all 226 canonical lmcode_std_v3 signatures
new Registry(false)LmCode.RegistryCreate an empty registry without the standard library catalog
Program.Load(bc, schema, reg)LmCode.ProgramVerify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths
program.Run(ctx, reg)voidExecute the bytecode body against a per-run Context
program.Call(idx, ctx, reg, args)LmCode.ValueExecute an R49 rule entry by index with IReadOnlyList<Value> arguments
RestCatalog.RegisterRest(reg, opts)LmCode.Rest.RestControllerRe-bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller
InvocationResults.FromCommand(files)LmCode.InvocationResultsRead LMCODE_INVOCATION_FILE, manage per-part ResultSinks, and write LMCODE_RETURN frames
using LmCode;
using LmCode.Rest;

var registry = new Registry();
var rest = RestCatalog.RegisterRest(registry, new RestOptions { MaxBodyBytes = 1 << 20 });
var bytecode = File.ReadAllBytes(args[0]);
var schema = File.ReadAllBytes(args[1]);
var program = Program.Load(bytecode, schema, registry);
rest.Run(program);

Documentation pages

Source repository and releases