Proposal: Synchronous Literate Programming (SLP)
Objective
To promote Literate Programming (LP) as the primary development paradigm within the Dev-Centr ecosystem, using CentrMark as the native markup language for document-first application architecture.
1. The Syntax Advantage: Why CentrMark?
CentrMark is uniquely suited for LP compared to Markdown or AsciiDoc:
-
Block Directives (
:::): Allow for clear definition of "Tangle-aware" code blocks.::: tangle [file="app.c"]is cleaner than#| file: app.cand more expressive than raw Markdown. -
Virtual Indentation: By visually nesting content without physical tabs, LP documents remain readable even at extreme complexity.
-
Meta-Narrative (
): Allows the writer to keep "implementation notes" or "developer commentary" as a distinct layer from the primary instructional text. -
Definition Lists (
~ Term): Perfect for documenting API schemas or project structures.
2. Bridging the Architectural Gap: Synchronous Literate Programming (SLP)
Traditional LP systems (Tangle-and-Weave) are batch-processed and opaque. We propose an SLP Architecture powered by a Unified AST Database.
Unified AST Database
Instead of treating narrative and code as separate entities, they are sibling nodes in a single tree.
-
Bi-directional Editing: Modifying code in an IDE updates the AST, which serializes back to the
.cmksource. -
Context Awareness: The LSP (Language Server Protocol) knows exactly which narrative paragraph describes a specific line of code.
The Evolution Scrubber (Timeline)
We propose implementing a Replay Index for repository-based LP documents.
-
The document doesn’t just show the "final" code state.
-
Versions of code blocks are tracked (via
evolutionproperties). -
Users can use a "Scrubber UI" to watch the construction of a module, seeing exactly how a simple idea transformed into a robust implementation.
3. Implementation Plan for Dev-Centr
-
Core Parser Integration: Update the Dev-Centr core to support
.cmkparsing via a unified AST. -
Tangle/Weave as a Live Service: The "Tangle" process should happen on-save or on-change, essentially making the document-source synchronization instantaneous.
-
Timeline Visualizer: Build a GUI component that renders the evolution of a
::: code-evolutionblock across Git commits.