tabnas-expr 0.5.18

Pratt expression-operator plugin for the tabnas parsing engine, over the jsonic base grammar
Documentation
; Expressions' embedding: a plain tree as an expression document's tree,
; and back again. This is a library of definitions, each named
; `expr-...`, which a host links with its own program and with the render
; (alchemy's `compile_sources`). It has two entry points: `expr-embed`
; takes a plain tree's events to an expression tree's, and `expr-unembed`,
; its reverse, takes them back. Nothing else here is the host's to call.
;
; Both are the identity. The reader builds its trees on jsonic's values,
; so a plain tree is already an expression tree: a list whose first
; element is a default operator and whose count makes an operation is
; one, and the render writes it in infix, the operator being its source
; text (`+`, `-`, `*`, `/`, `%`, or `(` for a group) or an object that
; describes it, whose `src` member is that text, as the reader's own
; value carries it; every other value is a value of jsonic's, which the
; render writes as jsonic. A list that only looks like an operation
; reads back as the same tree either way, once each operator is reduced
; to its source text as the shared fixtures' simplifier, Go's `Simplify`
; and Rust's `simplify` reduce it.
;
; The plain trees that are not expression trees are the lists led by an
; object whose `src` member the simplifiers read as an operator that is
; not a default one, as they read a C syntax tree's tokens: they keep
; that `src` alone, so no document reads back as such a list. The render
; refuses it, with TARGET_VALUE_UNREPRESENTABLE and the object's path,
; rather than this embedding, since the render meets such a list from
; any source, one of the schema `expr` too, which reaches the render
; without an embedding, and it already holds the first object of a list
; to read the operator that object describes.
;
; What the round trip changes is what the render's conventions change
; (the manifest's loss list): an operator's description is written as
; its source text, a negative number reads back as the operator `-`
; applied to its magnitude, and a number that is not finite as a string.

; The embedding: a plain tree's events in, the same events out.
def expr-embed [input]
  input

; The reverse: an expression tree's events in, the same events out.
def expr-unembed [input]
  input