Liking cljdoc? Tell your friends :D

hive-gimp.py.ast

The Python AST as data: the DOMAIN value of hive-gimp.py.

Every node is a map carrying :py/node. Lowering (hive-gimp.py.lower) produces these, rendering (hive-gimp.py.render) consumes them, and nothing in between speaks Python text. The node shapes are the contract in docs/py-strata.md; this namespace is where that contract is checkable.

REGISTERED, NOT PRIVATE

Every schema is registered in the hive schema registry (hive-schemas, over hive-spi) at load time, under :hive-gimp.py/* for the aggregates and :hive-gimp.py.expr/<node> / :hive-gimp.py.stmt/<node> per node. Any namespace, test or tool can then validate or GENERATE an AST by key, and the generators are what the trifecta properties run on.

OPEN BY REGISTRATION

The node vocabulary is two maps, expr-nodes and stmt-nodes, keyed by the :py/node value. A new node is a new entry, never an edit to a dispatch: Expr and Stmt are :multi schemas built from those maps. Every node map is CLOSED and pins its own :py/node, so a misspelt key is a validation error rather than a silently ignored field. A key documented as -or-nil may be absent or nil.

Pure apart from the idempotent registration: no Python, no rendering.

The Python AST as data: the DOMAIN value of `hive-gimp.py`.

Every node is a map carrying `:py/node`. Lowering (`hive-gimp.py.lower`)
produces these, rendering (`hive-gimp.py.render`) consumes them, and nothing
in between speaks Python text. The node shapes are the contract in
`docs/py-strata.md`; this namespace is where that contract is checkable.

REGISTERED, NOT PRIVATE

Every schema is registered in the hive schema registry (hive-schemas, over
hive-spi) at load time, under `:hive-gimp.py/*` for the aggregates and
`:hive-gimp.py.expr/<node>` / `:hive-gimp.py.stmt/<node>` per node. Any
namespace, test or tool can then validate or GENERATE an AST by key, and
the generators are what the trifecta properties run on.

OPEN BY REGISTRATION

The node vocabulary is two maps, `expr-nodes` and `stmt-nodes`, keyed by the
`:py/node` value. A new node is a new entry, never an edit to a dispatch:
`Expr` and `Stmt` are `:multi` schemas built from those maps. Every node map
is CLOSED and pins its own `:py/node`, so a misspelt key is a validation
error rather than a silently ignored field. A key documented as `-or-nil`
may be absent or nil.

Pure apart from the idempotent registration: no Python, no rendering.
raw docstring

binary-operatorsclj

The Python spellings a :binop may carry. Register an operator here.

The Python spellings a `:binop` may carry. Register an operator here.
sourceraw docstring

explainclj

(explain x)
(explain schema x)

nil when x conforms, else the humanized malli explanation.

nil when `x` conforms, else the humanized malli explanation.
sourceraw docstring

Exprclj

Any expression node.

Any expression node.
sourceraw docstring

expr-nodesclj

Expression node schemas by :py/node. Register a node by adding an entry.

Expression node schemas by `:py/node`. Register a node by adding an entry.
sourceraw docstring

LiteralValueclj

A Clojure value render can spell.

A Clojure value render can spell.
sourceraw docstring

Moduleclj

A vector of statements: one block.

A vector of statements: one block.
sourceraw docstring

Paramsclj

{:fixed ["a"] :rest "r"}.

`{:fixed ["a"] :rest "r"}`.
sourceraw docstring

schemasclj

Every schema this namespace contributes, by registry key.

Every schema this namespace contributes, by registry key.
sourceraw docstring

Stmtclj

Any statement node.

Any statement node.
sourceraw docstring

stmt-nodesclj

Statement node schemas by :py/node. Register a node by adding an entry.

Statement node schemas by `:py/node`. Register a node by adding an entry.
sourceraw docstring

Targetclj

An assignment or loop target.

An assignment or loop target.
sourceraw docstring

unary-operatorsclj

The Python spellings a :unop may carry. Register an operator here.

The Python spellings a `:unop` may carry. Register an operator here.
sourceraw docstring

valid?clj

(valid? x)
(valid? schema x)

True when x conforms to schema (Expr, Stmt, Target, Params, Module, or a registry key). With one argument the schema is inferred: vector Module, statement node Stmt, otherwise Expr.

True when `x` conforms to `schema` (Expr, Stmt, Target, Params, Module, or
a registry key). With one argument the schema is inferred: vector Module,
statement node Stmt, otherwise Expr.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close