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
| Item | Signature / Value | Role |
|---|---|---|
| new Registry() | LmCode.Registry | Create a registry preloaded with all 226 canonical lmcode_std_v3 signatures |
| new Registry(false) | LmCode.Registry | Create an empty registry without the standard library catalog |
| Program.Load(bc, schema, reg) | LmCode.Program | Verify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths |
| program.Run(ctx, reg) | void | Execute the bytecode body against a per-run Context |
| program.Call(idx, ctx, reg, args) | LmCode.Value | Execute an R49 rule entry by index with IReadOnlyList<Value> arguments |
| RestCatalog.RegisterRest(reg, opts) | LmCode.Rest.RestController | Re-bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller |
| InvocationResults.FromCommand(files) | LmCode.InvocationResults | Read 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);