calm.template — Lilush API

←index

← calm

Overview

CALM template DSL parser and sequence builder.

Template is a string with semicolon-separated entries.

Template spec syntaxDescription
BOSbare token
QUERY:inputsimple 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:noterepeated with subtoken
QUERY:input/BLOCK:noteframe with subtoken (non-repeated)
QUERY:input/ATN/BLOCK:noteframe_sub with embedded bare token
ATNbare
REPLY:outputlast frame after ATN is terminal (no <END>)

Functions

NameSignature
parseparse(spec) -> elements, err
buildbuild(elements, opts, budget) -> tokens
validatevalidate(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