Loom is a small language prototype optimized for LLM automation. It is intentionally AST-first and ID-centric:
- S-expression syntax
- explicit IDs on every node (
@<id>) - strict explicit typing (
i64,i1) - structured JSON patching by node ID
- machine-readable CLI output
- non-empty program form (single function or non-empty function list)
- Supported runtime: Python 3.13
- Supported invocation path:
loom - JSON output is the only CLI output mode
python -m loom.cliis internal and not part of the public interface
loom/sexpr.py: S-expression parser/printerloom/ast.py: strict AST + parser from S-expressionsloom/type_checker.py: semantic/type validationloom/codegen.py: LLVM IR generation + JIT execution viallvmliteloom/patch.py: JSON patch document model and patch engineloom/cli.py: machine-first CLI (check,run,compile,patch,validate)loom/tests/: parser/type/codegen/patch/CLI testsdocs/: language spec, patch spec, migration, CLI contract, release checklist
python3.13 -m venv .venv
source .venv/bin/activate
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python -m pip install -e ".[dev]"make check
make smokeTargets:
make venv: create.venvwithpython3.13make install: install runtime + dev dependenciesmake test: unit testsmake lint: Ruffmake coverage: coverage report with fail-under thresholdmake check: lint + coverage + unit testsmake dist: build wheel and sdistmake smoke: canonical CLI smoke commands usingloommake release-smoke: install built wheel in fresh venv and run smoke checks
All responses return:
{
"ok": true,
"command": "check|run|compile|patch|validate|cli",
"schema_version": "1",
"data": {},
"errors": []
}command is "cli" for pre-dispatch parser/usage failures (for example unknown subcommands or invalid global flags).
Failure shape:
{
"ok": false,
"command": "patch",
"schema_version": "1",
"data": {},
"errors": [
{
"code": "PATCH_TARGET_NOT_FOUND",
"message": "...",
"node_id": 999,
"node_kind": "statement",
"op_index": 0
}
]
}loom check examples/multi_functions.loom
loom run examples/multi_functions.loom --fn add --args 10 32
loom compile examples/multi_functions.loom --emit llvm-ir
loom validate examples/multi_functions.loom --patch examples/patches/replace_add_rhs.json --atomic --typecheck
loom patch examples/multi_functions.loom --patch examples/patches/replace_add_rhs.json --atomic --out /tmp/patched.loom
loom run /tmp/patched.loom --fn add --args 2 3from loom import sexpr, ast, type_checker, codegen, patch
source = """
(fn @1 add ((@2 a i64) (@3 b i64)) i64
(block @4
(ret @5 (add_i64 @6 (var @7 a i64) (var @8 b i64)))
)
)
"""
program = ast.parse_program(sexpr.parse_sexpr(source))
type_checker.check_program(program)
funcs = codegen.compile_program(program)
print(funcs["add"](10, 32))- Loom is pre-1.0 and may evolve quickly.
- CLI and patch schema changes are allowed between minor versions.
- Behavior changes are documented in
CHANGELOG.md.
- Language spec:
docs/LANGUAGE_SPEC.md - Patch spec:
docs/PATCH_SPEC.md - CLI spec:
docs/CLI_SPEC.md - Integration guide:
docs/INTEGRATION_GUIDE.md - Historical notes:
docs/MIGRATION_v0.2.md - Release checklist:
docs/RELEASE.md - Changelog:
CHANGELOG.md