Files
klammertext/README.md
Andy Kopra 4306dcd490 Recursion guard and static klammer checking
A klammer that reaches itself, directly or through a cycle, expanded
until the C++ stack was exhausted: the process died from SIGSEGV with no
message and no location. The former limit guarded only the top-level
fixed-point iteration, never the descent through klammer application. A
depth guard now raises a recursion error naming the klammer and where it
was applied. The same loop's termination test moves from "the katom list
stopped growing" to "a pass applied no klammer", since a klammer whose
body expands to nothing is a reduction that adds no katoms; exceeding the
round limit is now an error rather than a message followed by rendering a
document with live klammers still in it.

ktext --check locates every klammer application written in a document or
in a klammer body and checks name existence, argument count, option
names, and target coverage without applying anything, reporting all
problems at once. This is possible because Klammertext has no catcodes:
katom structure is fixed when a file is read, so a klammer body has a
determinate shape before it is expanded. The check therefore reaches what
the engine cannot -- the branch of a @cond that is not selected, and
bodies a given render never enters.

@cond's set of truth values is an open language question, so its meaning
is unchanged here; an unrecognized predicate now warns, giving its value
and location.

tst/ gains recursion_test.sh (7 cases) and check_test.sh (19 cases), and
this snapshot's test Makefile is generated from the shipped suite list so
the two cannot drift apart.

(from dev c27e63802406)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 15:41:43 +02:00

49 lines
1.8 KiB
Markdown

# Klammertext
Klammertext is a markup language that produces multiple output formats —
HTML, LaTeX/PDF, and plain text — from a single source description. Its core
engine, the Klammermachine, is written in C++; the Standard Klammer Set (SKS)
adds a default library of formatting and document-structuring operators on top.
## Installing
Installation guides are in [`doc/install/`](doc/install/):
- Linux, from source — `doc/install/linux_source_install.md`
- macOS, from source — `doc/install/macos_source_install.md`
- Linux, container — `doc/install/linux_container_install.md`
- macOS, container — `doc/install/macos_container_install.md`
## Building from source
With a C++20 compiler and `KLAMMERTEXT_HOME` set to this directory:
make -C com
This builds the Klammermachine library (into `lib/`), the SKS components, and
the three commands — `ktext`, `kdesc`, `kdiag` (into `bin/`). See the
source-install guide for prerequisites (TeX Live for PDF output, Python, and so
on).
## Editor support
Editing support for Emacs, Sublime Text, Vim, and Visual Studio Code —
syntax highlighting, delimiter matching, structural reindentation, table
alignment, diagnostics — is in [`doc/edit/`](doc/edit/), together with the
shared implementation and the Klammertext language server they build on.
## Provenance
This repository is a curated snapshot of Klammertext's private development
tree, assembled by a manifest-driven script. Its history is a series of
release snapshots, not a mirror of the development history, and files here
are regenerated on each release — patches cannot be merged directly.
Report problems (or send patches) to the author; accepted changes are
applied to the development tree and appear in a following snapshot.
This snapshot was assembled from development commit `c27e63802406`.
## License
See [`LICENSE.md`](LICENSE.md).