Liking cljdoc? Tell your friends :D

meme-lang.stages

Composable pipeline stages for the lossless reader.

Tooling pipeline: step-parse → step-read Eval pipeline: step-parse → step-read → step-evaluate-reader-conditionals → step-expand-syntax-quotes

Each stage is a ctx → ctx function operating on a shared context map:

KeyTypeWritten byRead by
:sourceStringcallerparse
:optsMap or nilcallerparse, read, eval-rc
:cstVectorparseread, (tooling)
:formsVectorreadcaller, eval-rc, expand

The table above is mirrored as machine-readable data in stage-contracts. Each stage calls check-contract! at entry, so miscomposed pipelines (e.g. calling step-read before step-parse) throw a clear pipeline-error with the missing key(s) and the actual ctx-keys present, instead of surfacing deep-inside NPEs.

Stages are independent. Compose in any order respecting dependencies. Skip step-read for tooling that works with CST directly.

Composable pipeline stages for the lossless reader.

Tooling pipeline: step-parse → step-read
Eval pipeline:    step-parse → step-read → step-evaluate-reader-conditionals → step-expand-syntax-quotes

Each stage is a ctx → ctx function operating on a shared context map:

| Key          | Type           | Written by  | Read by                |
|--------------|----------------|-------------|------------------------|
| :source      | String         | caller      | parse                  |
| :opts        | Map or nil     | caller      | parse, read, eval-rc   |
| :cst         | Vector         | parse       | read, (tooling)        |
| :forms       | Vector         | read        | caller, eval-rc, expand|

The table above is mirrored as machine-readable data in `stage-contracts`.
Each stage calls `check-contract!` at entry, so miscomposed pipelines
(e.g. calling step-read before step-parse) throw a clear pipeline-error
with the missing key(s) and the actual ctx-keys present, instead of
surfacing deep-inside NPEs.

Stages are independent.  Compose in any order respecting dependencies.
Skip step-read for tooling that works with CST directly.
raw docstring

expand-syntax-quotesclj/s

(expand-syntax-quotes forms opts)

Expand syntax-quote AST nodes in a seq of forms. Convenience wrapper around step-expand-syntax-quotes for callers that don't need the full pipeline context map.

Expand syntax-quote AST nodes in a seq of forms. Convenience wrapper
around step-expand-syntax-quotes for callers that don't need the
full pipeline context map.
sourceraw docstring

runclj/s

(run source)
(run source opts)

Run the full pipeline: source → CST → forms.

Run the full pipeline: source → CST → forms.
sourceraw docstring

stage-contractsclj/s

Machine-readable pipeline contract. Each entry is {:requires #{ctx-keys} :produces #{ctx-keys}}.

:requires is enforced at runtime by check-contract!; :produces is documentation — if a stage fails to produce what it claims, the next stage's :requires check catches the mistake, so post-condition runtime checks would be redundant.

Machine-readable pipeline contract.  Each entry is
`{:requires #{ctx-keys} :produces #{ctx-keys}}`.

`:requires` is enforced at runtime by `check-contract!`; `:produces`
is documentation — if a stage fails to produce what it claims, the
next stage's `:requires` check catches the mistake, so post-condition
runtime checks would be redundant.
sourceraw docstring

step-evaluate-reader-conditionalsclj/s

(step-evaluate-reader-conditionals ctx)

Evaluate MemeReaderConditional records in :forms for the target platform.

Replaces each #? with its matched branch value (or removes it if no branch matches). Splices each #?@ match into its containing collection. Recurses into syntax-quote / unquote / unquote-splicing interiors, matching native Clojure's order where the reader evaluates #? before ` is processed.

opts (from ctx's :opts): :platform — :clj, :cljs, or any platform keyword. Default: current compile-time platform. Pass explicitly to materialize forms for a different target (e.g. generating .cljs output on JVM).

Reads :forms, writes :forms.

Evaluate MemeReaderConditional records in :forms for the target platform.

Replaces each #? with its matched branch value (or removes it if no branch
matches). Splices each #?@ match into its containing collection.
Recurses into syntax-quote / unquote / unquote-splicing interiors, matching
native Clojure's order where the reader evaluates #? before ` is processed.

opts (from ctx's :opts):
  :platform — :clj, :cljs, or any platform keyword. Default: current
              compile-time platform. Pass explicitly to materialize forms
              for a different target (e.g. generating .cljs output on JVM).

Reads :forms, writes :forms.
sourceraw docstring

step-expand-syntax-quotesclj/s

(step-expand-syntax-quotes ctx)

Expand syntax-quote AST nodes, unwrap MemeRaw values, and convert MemeAutoKeyword records to eval-able forms in :forms. Produces plain Clojure forms ready for eval.

Expand syntax-quote AST nodes, unwrap MemeRaw values, and convert
MemeAutoKeyword records to eval-able forms in :forms.
Produces plain Clojure forms ready for eval.
sourceraw docstring

step-parseclj/s

(step-parse ctx)

Parse source string into CST using the unified Pratt parser. Uses meme grammar by default, or (:grammar opts) if provided. Reads :source, writes :cst.

Parse source string into CST using the unified Pratt parser.
Uses meme grammar by default, or (:grammar opts) if provided.
Reads :source, writes :cst.
sourceraw docstring

step-readclj/s

(step-read ctx)

Lower CST to Clojure forms via the CST reader. Reads :cst, writes :forms.

Reader conditionals are always preserved as MemeReaderConditional records; the historical :read-cond opt is no longer accepted and throws :meme-lang/deprecated-opt. To evaluate #?/#?@ for a target platform, compose step-evaluate-reader-conditionals after this stage.

Lower CST to Clojure forms via the CST reader.
Reads :cst, writes :forms.

Reader conditionals are always preserved as MemeReaderConditional records;
the historical :read-cond opt is no longer accepted and throws
:meme-lang/deprecated-opt. To evaluate #?/#?@ for a target platform,
compose step-evaluate-reader-conditionals after this stage.
sourceraw docstring

strip-shebangclj/s

(strip-shebang source)

Strip a leading #! shebang line from source.

Strip a leading #! shebang line from source.
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