lmcode
lmcode is the specification, DSLB v6 bytecode contract, 226-signature standard catalog, and conformance suite for schema-bound host programs. It defines the grammar, schema format, verifier rules, standard REST and CLI interfaces, invocation result protocol, and cross-runtime test vectors.
Quick reference
git clone https://github.com/lmctl-ai/lmcode.git
cd lmcode
npm install -g @lmctl-ai/lmctl
python3 tests/grammar/tree_sitter_differential.py --json /tmp/tree-sitter-diff.json
| Item | Signature / Value | Role |
|---|---|---|
| Bytecode format | DSLB v6 | Schema-hash bound bytecode with typed imports, line table, and R49 entry table |
| Schema version | dsl.schema: 2 | Declares host types, methods, functions, contexts, enums, operators, interfaces, and result contract |
| Standard catalog | lmcode_std_v3 (226 signatures) | Strings, byte codecs, math, files, collections, containers, strict JSON, templates, returns, and REST/CLI |
| Standard interfaces | 10 interfaces | RestGet..RestOptions, RestHandler, CliCommand, and CliOption on RestExchange |
| Return protocol | LMCODE_RETURN_BEGIN / END | Single-shot compact UTF-8 JSON result envelope after body, entries, and app checks |
| Host CLI flags | --lmcode, --lmcode-schema, --lmcode-signatures | Standard discovery and execution flags with exit codes 0, 2, 3, and 4 |
program = _lmcode_ schema="host.schema.json";
@"/users/:id"
fn get_user(x: RestExchange) -> void implements RestGet {
x.json("{\"id\":\"" + x.param("id") + "\"}");
}
@"status"
fn cli_status(x: RestExchange) -> void implements CliCommand {
x.send("ok:" + x.param("arg0"));
}
rest_config("prefix", "/api");
$return.preview = rest_cli(qw/status ready/);
rest_serve();
end _lmcode_