Language Design History
Vyasa Language Design History
Section titled “Vyasa Language Design History”In reverse chronological order
2026-02-14: Collection View Fixes & RFC-016
Section titled “2026-02-14: Collection View Fixes & RFC-016”- Bug Fix: Entity labels (e.g.,
dhritarashtra_label_dev) were not substituting in Collection View.- Root Cause:
builder.rssearchedenv.contextfor flattened keys, butconfig.rsstored entity data inenv.entities(a structured map). - Fix:
builder.rsnow queriesenv.entitiesdirectly, with fallback toenv.context.
- Root Cause:
- Bug Fix: Collection View verses displayed without line breaks (while Single File View was correct).
- Root Cause:
extract_text()flattenedSegmentBreaknodes to\n, which HTML collapses. Single File View renderedSegmentBreakas<br />via the Projector. - Fix:
extract_text()now emits<br />forSegmentBreak, matching the backend’s rendering.
- Root Cause:
- RFC: Created RFC-016: Break-After Setting — a configurable
break_aftersetting for automatic line breaks after Unicode punctuation (e.g., Devanagari Danda।).
2026-02-12: Generic Content Extraction
Section titled “2026-02-12: Generic Content Extraction”- Feature: Implemented Attribute-Driven Extraction (
extract="...") for Collections.- Goal: Decouple the compiler from specific schemas (like “devanagari”, “iast”).
- Mechanism:
extract="cmd1, cmd2": Extracts content of child commands intowork.items.{i}.{cmd}.infer_{key}="cmd1, cmd2": Infers context values based on command presence (e.g.,infer_speaker="arjuna"-> setsspeaker=arjuna).
- Entities: Automatically flattens entity properties (e.g.,
entities.arjuna.label->speaker_label).
- Refactor: Renamed
work.chapterstowork.itemsto be semantic-neutral.
2026-02-08: Template System Refactoring
Section titled “2026-02-08: Template System Refactoring”- Structure: Templates are now organized by target format (e.g.,
templates/html/). - Simplification:
- Default:
default.htmlis automatically used if no string template is provided. - Implicit:
.vyfiles intemplates/<target>/are implicitly treated as templates for that target. - Syntax: Reduced verboisty.
`verse { ... }intemplates/html/implies`template `verse `for "html".
- Default:
- Flexibility: Support for multiple shell templates via
vyasac build --template <name>.
2026-02-07: Default Template & Optimization
Section titled “2026-02-07: Default Template & Optimization”- Experience: Added “Built-in HTML” option in PlayArea using a baked-in, clean
src/backend/html/default_template.html(Noto Serif typography, no custom classes). - Refinement: Renamed “AST” to “AST (JSON)” for clarity.
- Optimization: Removed
handlebarsdependency and optimized WASM build (LTO enabled, ~500KB binary).
2026-02-07: Title Command & Structure Refinement
Section titled “2026-02-07: Title Command & Structure Refinement”- Feature: Introduced
titleas a first-class structural command.- Semantics: Distinct from
headinglevel 1. Represents the formal title of a document or work. - Output: Renders as
<h1 class="title">in HTML.
- Semantics: Distinct from
- Discussion: Evaluated
h1-h6vssectiondebate.- Retained
h1aliases for pragmatism (HTML similarity). titleserves as the semantic root for the document’s identity.
- Retained
2026-02-06: Native Templates & Projection
Section titled “2026-02-06: Native Templates & Projection”- Major Feature: Implemented Native Templates (RFC-011).
- Concept: Vyasa can now define its own output format using
templateblocks. - Syntax:
`template `cmd_name `for "html" { ... }. - Engine:
Projectormodule replaces Handlebars/Tera.
- Concept: Vyasa can now define its own output format using
- Benefit: Removes external dependencies, reduces WASM size, and keeps the entire build definition within the Vyasa language.
- Binding: Templates bind to AST nodes.
$.text,$.argument,$.attributesare available in scope.
2026-02-04: Graph Sink
Section titled “2026-02-04: Graph Sink”- Arch: Compiler now outputs
nodesmap (AST) alongside files. - Persistence:
sqlite-service.tsbridges this AST into thenodestable in the browser DB. - Result: “Git-in-a-DB” is fully operational for both source code and compiled graph.
2026-02-03: SQLite VFS
Section titled “2026-02-03: SQLite VFS”- Arch: Implemented
SqliteFileSystem(VFS) in Rust. - Flow: Browser (JS) -> SQLite (OPFS) -> Rust VFS -> Compiler.
- Benefit: Zero-copy (conceptually) access to source files from the compiler running in WASM.
2026-02-02: Tera Template Simplification
Section titled “2026-02-02: Tera Template Simplification”- Feature: Custom Tera filters (
is_cmd,is_text) for cleaner template conditionals. - Feature: Context shortcuts (
env,entities,ctx,settings) injected into template context. - Feature:
_macros.htmlstdlib template withrender_children,text_contentmacros. - Refactor: BG template uses dynamic
entities[speaker]lookup — removed hardcoded if/elif chains. - Impact:
backend/html/tera.rsupdated; samples use entity labels fromcontext.vy.
2026-02-02: Ignore-Whitespace Mode
Section titled “2026-02-02: Ignore-Whitespace Mode”- Feature: Added
settingsmap toVyasaEnvironmentfor workspace-wide configuration (separate from flowcontext). - Default: Whitespace-only text nodes are now stripped and text values are trimmed.
- Produces cleaner AST/JSON for structured content.
- Opt-out:
`set settings { whitespace = "preserve" }retains whitespace (for prose).
- Impact:
pipeline.rsnow includesstrip_whitespace()pass;intimate-notesample updated with preserve setting.
2026-02-02: Shared Workspace Processor
Section titled “2026-02-02: Shared Workspace Processor”- Refactor: Created
workspace_processor.rsmodule to centralize context loading.load_context_chain(): Walks the directory tree loadingcontext.vyat each level.WorkspaceFileIterator: Efficient iterator with context caching.
- Fix:
packer.rsnow properly resolves subdirectory context (e.g.,content/18/context.vy→{chapter}="18"). - Cleanup: Removed dead alias resolution code from
enricher.rs(already done byalias_resolver.rs). - Impact: Ensures behavioral parity between
buildandpackcommands.
2026-02-01: Segment Addressing & Flow State
Section titled “2026-02-01: Segment Addressing & Flow State”- Feature: Implemented Segment Addressing (RFC 005), allowing URNs with path components (e.g.
/d,/s:1) to target specific sub-structures. - Feature: Implemented Flow State (Context Persistence).
- Natural Sorting: The compiler now respects numeric order in filenames (
1.vy->2.vy). - State Threading: Speaker context (
entity) defined in one file persists to the next, enabling proper sequencing for multi-file works.
- Natural Sorting: The compiler now respects numeric order in filenames (
- Impact:
vyasac/src/resolver.rs: New module for URN resolution.vyasac/src/packer.rs: Updated to sort files and thread state.
2026-02-01: Template Logic Simplification
Section titled “2026-02-01: Template Logic Simplification”- Refactor: Changed
Nodeserialization from Externally Tagged ({ "Command": { ... } }) to Internally Tagged ({ "type": "Command", ... }).- Rationale: Greatly simplifies Tera templates by removing the need for verbose checks like
{% if node.Command %}and accessingnode.Command.cmd. - New Syntax:
{% if node.type == "Command" %}then accessnode.cmddirectly.
- Rationale: Greatly simplifies Tera templates by removing the need for verbose checks like
- Fix: Corrected canonical URN generation logic in the compiler CLI to match the enrichment logic.
- Impact: Verses now correctly generate
urn:verse:...instead of falling back to default work URNs.
- Impact: Verses now correctly generate
2026-02-01: Entity-Action Pattern
Section titled “2026-02-01: Entity-Action Pattern”- Design Decision: Adopted Entity-Action Pattern (
`Subject `Verb [...]) for defining graph relationships (e.g., Speaker-Speech) to avoid dense key-value syntax.
2026-01-31: Verse Elevation & Experience
Section titled “2026-01-31: Verse Elevation & Experience”- Semantic Refinement: The
versecommand (v) is now a first-class citizen with an optionalidargument.- Syntax:
`v 1 [ ... ]combines definition and content. - Benefit: Simplifies the authoring experience for standard scriptures, removing the need for separate
markercommands for simple structures.
- Syntax:
- Editor Experience:
- Implemented Word Wrap (toggleable) in
PlayArea. - Implemented Syntax Highlighting for
.vyfiles, mapping commands to HTML-like tags for intuitive coloring.
- Implemented Word Wrap (toggleable) in
- Cleanup: Removed unused legacy aliases (
col-break,pg-break) to streamline the core language. - Refinement: Reclaimed
verse(v) as a built-in structural container. - Alias Change: Re-aliased
markertom(wasv) to avoid conflict and optimize for “Writer” experience. - Impact:
stdlib.vy: Addedversecommand. Addedm->markeralias.commands.md: Updated documentation.- Samples: Updated Bible and Gita samples to use new
m/vschema.
2026-01-30: Marker Resolution & URN Fallback
Section titled “2026-01-30: Marker Resolution & URN Fallback”- Refinement: Improved the
packcommand’s analysis pipeline.- Marker Counting: Ensure aliases (like
v->marker) are fully resolved before generating manifest statistics. - URN Fallback: If
urn_schemeis missing inmanifest.json, the packer now correctly resolves it fromcontext.vywithin the environment.
- Marker Counting: Ensure aliases (like
2026-01-29: Semantic Refactoring (Marker vs Citation)
Section titled “2026-01-29: Semantic Refactoring (Marker vs Citation)”- Problem: The
referencecommand (aliasedr) was ambiguous. It was used both to define a structure (Verse 1) and to point to one (John 3:16). - Solution: Split the semantics.
marker(aliasv): Defines a structural anchor and sets the ID.ref(aliasr,cite): Points to a target URN (Citation).
- Impact:
- Renamed
reference->markerin Standard Library. - Updated
bibleandbhagavad-gitasamples to usevcommand.
- Renamed
2026-01-28: Whitespace Preservation
Section titled “2026-01-28: Whitespace Preservation”- Problem: Previous versions aggressively stripped whitespace between nodes, making it impossible to render poetry or lists where line breaks mattered.
- Fix: Modified parser to preserve text whitespace as
Textnodes. - Impact:
- Prose: Unaffected (HTML collapses whitespace naturally).
- Poetry: Can now be rendered correctly using CSS
white-space: pre-wrapon container blocks (e.g.,preformatted).
2026-01-27: Standard Library Refinement
Section titled “2026-01-27: Standard Library Refinement”- Decision: Cleaned up
builtins.vyto include only Meta and Formatting commands. Domain-specific commands (likeverse) moved to context configuration. - Standardization: Renamed
def-aliastoalias-defto align withcommand-def. - Headings: Added hierarchical
headingcommand andh1-h3aliases.
2026-01-26: Explicit Formatting & Context URNs
Section titled “2026-01-26: Explicit Formatting & Context URNs”- Decision: Adopted Explicit Formatting Commands (
br,e1,e2) over implicit markdown-like syntax or raw HTML.- Rationale: Ensures portability and consistent rendering across environments (WASM/Editor). implicit double-newlines for breaks proved fragile.
- URNs: Moved URN scheme definition from static
vyasac.tomlto dynamiccontext.vy.- Reason: Allows different parts of a workspace (e.g., Intro vs Main Text) to use different URN structures.
2026-01-25: Stream vs. Container Architecture
Section titled “2026-01-25: Stream vs. Container Architecture”- Concept: Formalized two valid ways to structure content.
- Stream-based: Using
reference(aliased asr) to mark points in a continuous flow. Best for narratives (e.g., Bible). - Container-based: Using
verseblocks to contain content. Best for structured data (e.g., Gita).
- Stream-based: Using
- Addition: Added
versecommand as a standard container that inherits the active URN.
2025-12-31: URN Attributes & Enrichment
Section titled “2025-12-31: URN Attributes & Enrichment”- Decision: Reference identifiers (
r 1.1) are insufficient for global linking. - Change: Added an “Enrichment” pass that computes a
urnattribute for every reference node based on a configured scheme (e.g.,urn:vyasa:{work}:{id}). - Syntax impact: None (purely semantic/compiler behavior).
2025-12-30: Text Stream Patterns
Section titled “2025-12-30: Text Stream Patterns”- Problem: Explicitly tagging every line in a large block (like a specific translation or transliteration stream) is verbose.
- Solution: Introduced
stream-defand Implicit Tagging. - Syntax:
`stream-def { id="gita"; pattern="d, i, e" }`gita`[Text for 'd'Text for 'i'Text for 'e'`]
- Mechanism: The parser treats the block content as a sequence of text lines, and a Transformer pass applies the pattern commands (
d,i,e) cyclically to the lines.
2025-12-30: Unified Command Model (Refactor)
Section titled “2025-12-30: Unified Command Model (Refactor)”- Problem: The grammar had special cases for “Blocks” vs “Commands” vs “References”.
- Solution: Everything is a Command.
- Block: A command with a delimiter and children.
- Reference: A command (
r) with an argument. - Metadata: A command (
set) with attributes.
- Syntax:
- Inline:
`cmd arg {attrs} - Block:
`cmd arg ;DELIM {attrs} [ ... ]DELIM
- Inline:
- Impact: drastically simplified the AST (
Node::Commandcovers 90% of nodes) and Parser logic. - Removed: Explicit
Node::ReferenceandNode::Blockenums.
2025-12-29: Attributes Support
Section titled “2025-12-29: Attributes Support”- Decision: Commands need key-value metadata (e.g. time codes, ids).
- Syntax:
{ key="value"; key2=val2 }immediately following the command/arg. - Example:
`r 1.1 {t="16.32"}.
Initial Proposal
Section titled “Initial Proposal”- Markdown-like text.
- Backtick
`for commands. |for segment breaks.- Explicit
[]for blocks.