CALM template DSL parser and sequence builder.
Template is a string with semicolon-separated entries.
| Template spec syntax | Description |
|---|---|
BOS | bare token |
QUERY:input | simple frame: <QUERY> bytes <END> |
BLOCK:notes* | repeated frame: per item <BLOCK> bytes <END> |
BLOCK:items+ | NEXT-separated list: <BLOCK> a <NEXT> b ... <END> |
QUERY(q):queries*/BLOCK:note | repeated with subtoken |
QUERY:input/BLOCK:note | frame with subtoken (non-repeated) |
QUERY:input/ATN/BLOCK:note | frame_sub with embedded bare token |
ATN | bare |
REPLY:output | last frame after ATN is terminal (no <END>) |
| Name | Signature |
|---|---|
parse | parse(spec) -> elements, err |
build | build(elements, opts, budget) -> tokens |
validate | validate(spec) -> ok, err |
parse(
spec) ->elements,err
Parse a template spec string into an element descriptor array
build(
elements,opts,budget) ->tokens
Build a token sequence from a parsed template and an opts table
validate(
spec) ->ok,err
Validate a template spec string