tree-sitter-lmcode skill

Use tree-sitter-lmcode to parse standalone lmcode chunks for syntax highlighting, static analysis, editor outlines, and AST inspections.

Purpose

Provide a fast, incremental Tree-sitter parser and external C scanner for the inner lmcode language without executing scripts or invoking the compiler.

When to use it

Use tree-sitter-lmcode when building editor integrations, syntax highlighters, linter rules, or AST analysis tools for _lmcode_ blocks.

Install

Install tree-sitter-cli 0.27.1 in a private prefix (or compile the committed src/parser.c and src/scanner.c directly with a C compiler) alongside Node 24 and Python 3.

Commands

tree-sitter generate
tree-sitter test --rebuild
python3 scripts/conformance.py
python3 scripts/negative.py
python3 scripts/incremental.py
python3 scripts/scanner-limits.py
python3 scripts/controls.py

Inputs and outputs

Safety rules

Worked examples

# Parse a single lmcode file and inspect its s-expression tree
tree-sitter parse test/fixtures/conformance/067-rule-method.lmcode

Errors and exit codes

Exit codeStageResultCondition
0parse / testExit 0All grammar generation, corpus cases, negative syntax-refusal checks, incremental edit gates, and mutation controls pass
1conformanceExit 1A corpus fixture produces unexpected ERROR or MISSING nodes, or a negative refusal fixture parses without syntax errors
1freshnessExit 1Generated src/parser.c, grammar.json, or node-types.json differs from grammar.js after tree-sitter generate
2cli / pinExit 2Missing TREE_SITTER CLI binary, mismatched tree-sitter-cli version (requires 0.27.1), or missing live corpus root

How to verify

tree-sitter test --rebuild
python3 scripts/conformance.py
python3 scripts/negative.py
python3 scripts/controls.py