Expand description
Direct term-lifting for the Python meta-language.
These helpers build the Arc<QTerm> that reconstructs a term by writing
constructor source (tb(..).c(child)..b(), quote(..), …) directly and
splicing child terms at holes. The emitted source is Python, targeting a
quilt Python runtime whose builder mirrors the Rust QTermBuilder fluent
API (tb/.c/.w/.n/.p/.x/.e/.b, quote/unquote, leaf/sym,
cmd/write/push/NL/POP/HOLE).
The fold that assembles those chains is shared with the Rust and TypeScript
metas — see crate::langs::chain. All that is Python-specific is which
fragments it writes, which is a generated table, and the escaping below.
One difference is not a spelling and so is not in the table: a variadic node
is a fluent .e() emit chain rather than Rust’s imperative
{ let mut b_ = ..; ..; b_.b() } block, which has no Python
expression-context equivalent. (A consequence: statement-context splicing —
control flow inside ↙..↘ that emits into a named b_ — is not expressible
in Python and is unsupported.)
Functions§
- build_
quote_ code - Build
quote(tag, index, lang, <term>, [..cmds..]), splicingterm. - build_
tuple_ code - Build code that reconstructs a tuple:
tb(tag).w(..).c(child)..b(), using thesym/leafshorthands when possible.childrenare the already-built child expressions spliced at hole positions. - build_
unquote_ code - Build
unquote(tag, index, lang, <term>, [..cmds..]), splicingterm. - build_
variadic_ block - Build a variadic node as a fluent emit chain:
tb(tag).e(child).p("..").n()..b().childrenare the already-expanded terms; each is emitted with.e(..)(which, like Rust’s.emit(&mut b_), appends one-or-more children). Unlike Rust’s variadic, there is no namedb_, so statement-context splicing is unsupported (see module docs). - name
- Make an identifier term (the
⟨N⟩operator).