tree-sitter-lmcode reference

Reference tables for tree-sitter-lmcode AST node types, external scanner tokens, verification scripts, and exit codes.

AST node and grammar surface

Node / ArtifactKindDescription
function_declarationNamed AST nodeFields: name, parameters, return_type, body; optional annotation and implements_clause children
annotationNamed AST nodeLeading @identifier or @"path/template" attached to a function_declaration
implements_clauseNamed AST nodeTrailing implements InterfaceName clause on a rule or REST/CLI entry
return_assignmentNamed AST nodeAssignment statement targeting $return, $return.field, or $return[key_expr]
map_entryNamed AST nodeKey-value pair separated by => inside %{ ... } map literals
spliceNamed AST nodeOuter-language ${...} splice expression parsed with nested brace and string tracking
heredoc_start / heredoc_bodyAST node + extraExpression-position heredoc tag and FIFO-paired raw body token
end_of_fileScanner sentinelZero-width EOF check ensuring unclosed queued heredocs fail closed

Standard REST and CLI interfaces recognized by the grammar

InterfaceCanonical declarationBehavior
RestGetinterface RestGet(exchange: RestExchange) -> voidHTTP GET endpoint bound by path annotation such as @"/users/:id"
RestPostinterface RestPost(exchange: RestExchange) -> voidHTTP POST endpoint bound by path annotation such as @"/users"
RestPutinterface RestPut(exchange: RestExchange) -> voidHTTP PUT endpoint bound by path annotation such as @"/users/:id"
RestDeleteinterface RestDelete(exchange: RestExchange) -> voidHTTP DELETE endpoint bound by path annotation such as @"/users/:id"
RestPatchinterface RestPatch(exchange: RestExchange) -> voidHTTP PATCH endpoint bound by path annotation such as @"/users/:id"
RestHeadinterface RestHead(exchange: RestExchange) -> voidHTTP HEAD endpoint bound by path annotation
RestOptionsinterface RestOptions(exchange: RestExchange) -> voidHTTP OPTIONS endpoint bound by path annotation
RestHandlerinterface RestHandler(exchange: RestExchange) -> voidMethod-prefixed (@"POST /users") or rest_route(method, path, annotation) handler
CliCommandinterface CliCommand(exchange: RestExchange) -> voidStateless CLI subcommand entry dispatched by rest_cli(args)
CliOptioninterface CliOption(exchange: RestExchange) -> voidStateless CLI flag or option entry dispatched before CliCommand by rest_cli(args)

Verification exit statuses

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