Skip to main content

Quilt Documentation

Quilt lets metaprograms in any language generate and manipulate code in any other language using five Unicode arrow glyphs.

A .quilt file is ordinary source code with Quilt brackets spliced in. Running quilt expand strips the brackets and writes plain source — no special build system required.

// squares.py.rs.quilt — a Rust program that generates Python
let squares: Vec<u64> = (1..=5).map(|n| n * n).collect();

let program = python↖
def main():
squares = ↙squares.↑↘
print(squares)

main()
;

println!("{}", program.coparse());
# generated squares.py
def main():
squares = [1, 4, 9, 16, 25]
print(squares)

main()

The five operators — quote ↖↗, unquote ↙↘, lift , reduce , emit — compose across any combination of supported languages. See Concepts for a full walkthrough.

Start here

  1. Concepts — the file format, all five operators, and how staging works
  2. CLI & Scriptsquilt expand, quilt run, and the helper scripts
  3. Editor Setup — VS Code extension with glyph keybindings and LSP support

Language

PageWhat it covers
ConceptsThe .quilt file format, operator glyphs, quasi-quoting, and staging

Tooling

PageWhat it covers
CLI & Scriptsquilt expand, quilt run, and the bin/ helper scripts
Python Bindingsquilt_python — the PyO3 runtime for .py.quilt files
Quilt LSPquilt-lsp — the multiplexing Language Server
Editor SetupVS Code extension, keybindings, and tools/quilt

Internals

Reference material for contributors and anyone extending Quilt.

PageWhat it covers
QTerm IRThe central QTerm data type and the QTermBuilder fluent API
Parse → Expand PipelineHow a .quilt file becomes ordinary source code
Language TraitsLanguage, LanguagePost, MetaLanguage — the extension points
Concrete LanguagesRust, Python, HTML, WGSL, Zsh, Bash, Text implementations
Multi and OmniThe Multi<LS,MS> engine and the Omni production registry
BootstrapSelf-hosting: generating meta.rs from mk_meta.rs.quilt
Adding a LanguageStep-by-step guide for supporting a new language
NanobotsThe gas-metered nanobot IR toolchain (sibling repo)

Repository layout

quilt/
├── quilt/ # Core library + CLI
├── quilt-lsp/ # Language Server
├── quilt-python/ # PyO3 bindings (Python runtime)
├── tree-sitter-quilt/ # Grammar for the Quilt bracket syntax
├── bin/ # Helper scripts: quilt, bootstrap, build-py, …
├── tools/quilt/ # VS Code extension
├── docs/wiki/ # This wiki
└── examples/ # Annotated .quilt examples